in reply to Re^7: Comparing Dates
in thread Comparing Dates

Whn i print them out I have the values like this... time1: 2006-03-29 12:00:00 time2: 2006-03-14 10:03:38 I am extremely sorry for the confusion but i am pulling the data from the db in to variables and then trying to do a diff. The way it displays on the form is 03/14/2006 10:05:50 AM so I got confused on the way it is stored... Thanks

Replies are listed 'Best First'.
Re^9: Comparing Dates
by ikegami (Patriarch) on Mar 14, 2006 at 16:16 UTC
    sub get_time_from_local_time_string { my ($time_string) = @_; my ($M, $D, $Y, $h, $m, $s) = $time_string =~ m{(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)}; return timelocal($s, $m, $h, $D, $M-1, $Y); }
    I don't know much about database dates, but if you can get it from the database as a number instead of as a string, it would be more reliable and faster.