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);