[Omaha.pm] DateTime::Duration ->days()

Jay Hannah jhannah at mutationgrid.com
Fri Jan 14 19:03:02 PST 2011


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 at mutationgrid.com | http://mutationgrid.com | 1-402-598-7782



More information about the Omaha-pm mailing list