[sf-perl] Date manipulation question
Richard Reina
gatorreina at gmail.com
Sat Jul 5 08:02:34 PDT 2008
Wow! I'll try that. Thanks a bunch.
2008/7/5, Bill Moseley <moseley at hank.org>:
> On Sat, Jul 05, 2008 at 08:48:20AM -0500, Richard Reina wrote:
>> I have a date that is a string such as: Thu Jul 3 17:43:45 2008
>> and need to convert it to epoch seconds. I am scowering my perl books
>> and the web but cannot find a function to help me do this. Does
>> anyone know how this can be done?
>
> perldoc Time::Local is one way.
>
> But, I like to have all my dates in DateTime objects. There's more than
> one parser that will work.
>
> $ perl -MDateTime::Format::DateParse -le 'print
> DateTime::Format::DateParse->parse_datetime( "Thu Jul 3 17:43:45
> 2008")->epoch'
> 1215132225
>
> $ perl -MDateTime::Format::HTTP -le 'print
> DateTime::Format::HTTP->parse_datetime( "Thu Jul 3 17:43:45 2008")->epoch'
> 1215107025
>
> --
> Bill Moseley
> moseley at hank.org
> Sent from my iMutt
>
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
>
More information about the SanFrancisco-pm
mailing list