Front page | perl.perl5.porters |
Postings from March 2000
Re: [ID 20000307.005] Date Problem
From:
Nick Ing-Simmons
Date:
March 7, 2000 10:11
Subject:
Re: [ID 20000307.005] Date Problem
Message ID:
200003071811.SAA00419@tiuk.ti.com
David Gillen <dgille.ca3@compapp.dcu.ie> writes:
>Problem. Perl not showing the day correctly, Eg today is Tue March the 7th,
>the program get Tue March the 8th. Seems to be due to the 29 Feb Problem for
>this year.
No it isn't - it is the base of your $day array.
(localtime)[3] is 1..31 rather than 0..30
>
>Example Code: (Don't laugh I know it ugly)
>
>$weekday = (Sun,Mon,Tue,Wed,Thur,Fri,Sat)[(localtime)[6]];
>$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]];
>$month =
>(January,February,March,April,May,June,July,August,September,October,Novembe
>r,December)[(localtime)[3]];
That last should be (localtime)[4]
--
Nick Ing-Simmons <nik@tiuk.ti.com>
Via, but not speaking for: Texas Instruments Ltd.