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

Hello Wise Monks, I am aware of the "time" function in Perl:

$secondssince1970=time;

print $secondssince1970;

This will output something like:

1087919818 My question is, if I have a date and time in mind, say, January 1, 2004 00:00.00, how do I get Perl to give me that in terms of seconds since 1970?

Thanks in advance.

Gorby

Replies are listed 'Best First'.
Re: Checking the Time
by Taulmarill (Deacon) on Jun 23, 2004 at 09:12 UTC
Re: Checking the Time
by neeraj (Scribe) on Jun 23, 2004 at 10:50 UTC
    use Time::Local; $TIME = timelocal($sec, $min, $hours, $mday, $mon, $year); $TIME = timegm($sec, $min, $hours, $mday, $mon, $year); Use timelocal if u are supplying local time, if u r givin GMT as argument, use timegm.
Re: Checking the Time
by borisz (Canon) on Jun 23, 2004 at 09:03 UTC
    Ups, I did not read it right, the first time:
    use HTTP::Date; print str2time('01-01-2004');
    scalar(time);
    Boris