How do I convert a date/time to epoch time in Perl?

Posted by dreeves on Stack Overflow See other posts from Stack Overflow or by dreeves
Published on 2008-09-18T18:40:08Z Indexed on 2010/03/23 11:23 UTC
Read the original article Hit count: 426

Filed under:
|
|
|
|

Given a date/time as an array of (year, month, day, hour, minute, second), how would you convert it to epoch time, i.e. the number of seconds since 1970-01-01 00:00:00 GMT?

Bonus question: If given the date/time as a string, how would you first parse it into the (y,m,d,h,m,s) array?

© Stack Overflow or respective owner

Related posts about perl

Related posts about parsing