in reply to Calculate Time Range
use Time::Local; my ($month, $mday, $year) = split "/", "06/08/2002"; my ($month2, $mday2,$year2) = split "/", "06/18/2002"; my $time = timelocal(0,0,0,$mday,$month-1,$year); my $time2 = timelocal(0,0,0,$mday2,$month2-1,$year2); my $diff = abs(($time - $time2)/(60*60*24)); print "diff = $diff\n";
You need to remember that the months are base 0. I grabbed the abs() difference but maybe you want to know if the difference is negative...
--
my $chainsaw = 'Perl';
|
|---|