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

Re: [ID 20000307.005] Date Problem

Nick Ing-Simmons
March 7, 2000 10:11
Re: [ID 20000307.005] Date Problem
Message ID:
David Gillen <> 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 =
>$month =

That last should be (localtime)[4] 

Nick Ing-Simmons <>
Via, but not speaking for: Texas Instruments Ltd. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About