[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Omaha.pm] DateTime::Duration ->days()
What the heck? Why is DateTime so popular? Date::Calc and Class::Date make this trivial.
$ cat j.pl
use 5.12.0;
use DateTime;
my $end = DateTime->new(year => 2011, month => 01, day => 14);
my $start = DateTime->new(year => 2007, month => 05, day => 15);
my $d = $end - $start;
say $d->days;
$ perl j.pl
2
Jay Hannah
Software Architect
jhannah@mutationgrid.com | http://mutationgrid.com | 1-402-598-7782