Well, here we go again with DateTime::Duration.
Here's a simple problem - How many days are between two DateTime's ? Here is my attempt, but it fails.
Suggestions?
========================================================= use DateTime;
my $tz = "America/Los_Angeles";
my $dt = new DateTime(
year => 2004,
month => 9,
day => 25,
time_zone => $tz);my $now = DateTime->now(time_zone => $tz); my $today = $now->clone->truncate(to => 'day'); my $day = $dt->clone->truncate(to => 'day');
printf("Number of days: %s\n", ($day - $today)->in_units('days'));
=========================================================
[EMAIL PROTECTED] ~]$ perl foo.pl
Number of days: -4
[EMAIL PROTECTED] ~]$
=========================================================- Max
