[ale] Perl 5 (localtime) - Y2K issue

Ben Coleman oloryn at mindspring.com
Thu Sep 2 19:12:49 EDT 1999


On Thu, 02 Sep 1999 14:40:46 -0400, Russell Enderby wrote:

>I guess the bottom line is if the intention is to get me just the last two digits it
>should be 01.  If it is supposed to give me the full date then 2001.  But 101 seems a
>bit odd.  Maybe I am the only one with this impression.

If you want the full 4-digit date, just add 1900(same as it's always
been).  If you want a 2-digit year, you use '(localtime)[5] % 100'.

Note: this behaviour is inherited from the C localtime function.  It's
not likely to change unless the definition of the C function changes.

Ben
--
Ben Coleman oloryn at mindspring.com    | The attempt to legislatively
http://oloryn.home.mindspring.com/   | micromanage equality results, at
                                     | best, in equal misery for all.






More information about the Ale mailing list