Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Nov 1995 11:33:28 +0100
From:      lutz@muc.de (Lutz Albers)
To:        jkh@freefall.freebsd.org
Cc:        freebsd-hackers@freefall.freebsd.org
Subject:   Re: Bug in stable/-current perl?
Message-ID:  <v02140402ace3347966b6@[193.174.4.22]>

next in thread | raw e-mail | index | archive | help
In article <199511290543.VAA13120@freefall.freebsd.org>, Jordan K. Hubbard
writes:

-
-jkh@freefall-> date
-Tue Nov 28 21:42:48 PST 1995
-
-jkh@freefall-> perl -e 'printf("%02.2d\n", (localtime())[3]);'
-28
-jkh@freefall-> perl -e 'printf("%02.2d\n", (localtime())[4]);'
-10
-jkh@freefall-> perl -e 'printf("%02.2d\n", (localtime())[5]);'
-95
-
-10?  Am I misunderstanding something fundamental about perl's
-localtime() call, or should this be an "11"?

10 is correct. Both monthnames and daynames are zero-based (0..11,0..6) in perl.
They can be used as offsets in a arry holding month/daynames that way
(well, that's th excuse from the camel book).

ciao
  lutz


---------------------------------------------------------------------
Lutz Albers                                     |       What's good ?
Luederitzstr. 14, 81929-Muenchen, Germany       |      Life's good -
email:lutz@muc.de          ph: +49-89-93940364  | But not fair at all
http://www.muc.de/~lutz    fax:+49-89-93940365  |          (Lou Reed)

Do not take life too seriously, you will never get out of it alive.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?v02140402ace3347966b6>