I use timelocal picking a time of day say noon to do the calculation. You
could use other modules, but very simple and straightforward.
use Time::Local;
# secs,minutes,hours,day,month,year
# You can subtract out the 1900, but it seems to smart enough to know to do it
# Need to subtract one from month
#
my $MyFirstTime = timelocal(0,0,12,1,1,2002);
my $My2ndTime = timelocal(0,0,12,28,1,2002);
my $MyDays = int($My2ndTime - $MyFirstTime)/ 86400;
printf "MyDays: $MyDays\n";
Output:
MyDays: 27
Wags ;)
-----Original Message-----
From: Imtiaz ahmad [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 11, 2002 13:19
To: '[EMAIL PROTECTED]'
Subject: days calculation
Hi-
Does anyone know how to calculate number of days if the dates are
'2002-02-01' '2002-02-28'?
In other words, if var1='2002-02-01' and var2='2002-02-28' then
how can we say days=var2-var1?
thanks.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]