There are lots of ways to do this, but I usually use the Date::Parse module.
It converts a date string into seconds (seconds since 1/1/1970).
use Date::Parse;
my $hour = 3600; # 1 hour = 3600 seconds
my $t1 = str2time("12/08/2003, 11:00");
my $t2 = str2time("13/08/2003, 23:00");
my $hours = ($t2 - $t1) / $hour;
I think Date::Calc may also help, but I am not too familiar with it. You
can check out the docs at search.cpan.org, and see which is more appropriate
for your needs.
Rob
-----Original Message-----
From: awards [mailto:[EMAIL PROTECTED]
Sent: Monday, August 11, 2003 2:24 PM
To: [EMAIL PROTECTED]
Subject: compare date,time
Hi,
I have the following
12/08/2003, 11:00
13/08/2003, 23:00
Now I would like to compare them and then calculate the how long time was
elapsed in terms of hours.
For the example above it will return 36 hours.
I don't know if there is a module that do that or a function or we just have
to program it?
regards,
Awards
--
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]