in reply to Re: date-time into seconds
in thread date-time into seconds

Date::Time: "This module does not parse dates! ... Instead, take a look at the various DateTime::Format::* modules on CPAN."

A suitable candidate in this case would be DateTime::Format::DateParse: "This module is a compatibility wrapper around Date::Parse."

So just use Date::Parse. The first two lines of a three line synopsis:

use Date::Parse; $time = str2time($date);

Replies are listed 'Best First'.
Re^3: date-time into seconds
by ikegami (Patriarch) on Dec 11, 2009 at 17:16 UTC

    Neither does Time::Local, but it didn't stop him from doing his own parsing. Do you really need a module to replace a regex match or

    my ($Y,$M,$D, $h,$m,$s) = unpack('A4xA2xA2xA2xA2xA2', $time_str);

    From that, you can contruct a DateTime object and do date and time arithmetic.

    That said, I don't see the need to replace Time::Local with DateTime here. It seems to me that L~R made appropriate and maximal use of modules. Now, if you wanted the answer to be of the form X days, Y Hours and Z Seconds, DateTime is your man!