develooper Front page | perl.perl5.porters | Postings from March 2000

Re: [ID 20000307.005] Date Problem

Thread Previous
From:
Jeff Pinyan
Date:
March 7, 2000 08:46
Subject:
Re: [ID 20000307.005] Date Problem
Message ID:
Pine.GSO.4.21.0003071144390.21801-100000@crusoe.crusoe.net
On Mar 7, Tom Christiansen said:

>>$month =
>>(January,February,March,April,May,June,July,August,September,October,Novembe
>>r,December)[(localtime)[3]];
>
>Good.
>
>>$day =
>>(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,
>>29,30,31)[(localtime)[3]];
>
>That's not what localtime is documented to do.  Some are offsets,
>some aren't.  

You didn't fry him on the fact that he used (localtime)[3] for both list
offsets (month and day).  He should have used (localtime)[4] for the month
offset.

-- 
MIDN 4/C PINYAN, NROTCURPI, US Naval Reserve             japhy@pobox.com
http://www.pobox.com/~japhy/                  http://pinyaj.stu.rpi.edu/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About