Coder's Guild Mailing List

Re: Perl: Date question

Posted by Peter Palfrader aka Weasel on 1999-11-09

On Tue, Nov 09, 1999 at 02:35:08PM +0100, Magnus Holm wrote:
> 
> How come
> 
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
> print "Date   : $mday:$mon:$year\n";
> 
> shows up just fine, except it's lagging one month?
> 
> The system clock says 09.11.1999, the program says "Date    : 9.10.99"


>from `man perlfunc`:

               All array elements are numeric, and come straight
               out of a struct tm.  In particular this means that
               $mon has the range 0..11 and $wday has the range
               0..6 with sunday as day 0.  Also, $year is the
               number of years since 1900, that is, $year is 123
               in year 2023.

HTH


-- 
Weasel                         http://www.cosy.sbg.ac.at/~ppalfrad/
PGP encrypted messages prefered.  See my site or finger -l ppalfrad
        Yes means No and No means Yes. Delete all files [Y]?