Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

epoch from time/date string?

by ido50 (Scribe)
on Jan 13, 2005 at 20:11 UTC ( [id://422085]=perlquestion: print w/replies, xml ) Need Help??

ido50 has asked for the wisdom of the Perl Monks concerning the following question:

Hi there!

This is not strictly a Perl question, but since I only program in Perl, and I need this for a Perl program, I'm turning to you guys.

Anywho, we all know that executing the localtime() function in scalar context prints the current time/date string (For example "Thu Oct 13 04:54:34 1994"), internally using the time function to get the current epoch.

That's all nice and well, but what if I have the time/date string, and want to convert back into epoch? How can I do that?

Thanks again.

-------------------------
Live fat, die young

Replies are listed 'Best First'.
Re: epoch from time/date string?
by ido50 (Scribe) on Jan 13, 2005 at 20:16 UTC
    Geesh, nevermind there... Super search gave me the answer on this node.

    -------------------------
    Live fat, die young
Re: epoch from time/date string?
by neeraj (Scribe) on Jan 14, 2005 at 03:42 UTC
    Use Time::Local module.try out this code:
    use Time::Local; $TIME = timelocal($sec, $min, $hours, $mday, $mon, $year);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://422085]
Approved by Paladin
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-18 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found