| Web Surfer 2004-03-18, 6:46 pm |
| [This followup was posted to alt.perl]
In article <c102br$1ri$1$8300dec7@news.demon.co.uk>, moe6@lycos.co.uk
says...
> Hi
>
> I am trying to convert the current date into epoch seconds.
>
> I am experimenting with a simple script that does not seem to work and I do
> not see what I am doinf wrong here. Script is as follows :
>
> =======================
> use Time::Local;
>
> $time = timelocal($sec);
>
> print "$sec";
> =======================
>
> Any advice would be much appreciated.
>
> M
You should have a look at the information produced by the command
"perldoc time::local". I have included the first few lines.
NAME
Time::Local - efficiently compute time from local and GMT time
SYNOPSIS
$time = timelocal($sec,$min,$hour,$mday,$mon,$ye
ar);
$time = timegm($sec,$min,$hour,$mday,$mon,$year)
;
DESCRIPTION
These routines are the inverse of built-in perl functions localtime
()
and gmtime(). They accept a date as a six-element array, and return
the
corresponding time(2) value in seconds since the Epoch (Midnight,
January 1, 1970). This value can be positive or negative.
|