On Monday 26 April 2004 03:07 am, Alok Bhatt wrote:
> Hi All,
>
>  I am facing this strange problem related to dates.
> When I print the date using the system's date command,
> it prints correctly. But when I do the same using
> localtime, it shows the month as wrong (1 month
> previous.
>
> bash-2.03$ perl -e '@a=localtime; print "@a\n"'
> 18 4 8 26 3 104 1 116 0
>          ^^^
> bash-2.03$ perl -e '@a=localtime(time); print "@a\n"'
> 20 4 8 26 3 104 1 116 0
>          ^^^
> bash-2.03$ date
> Mon Apr 26 08:04:23 GMT 2004
> bash-2.03$
>
> It shows the month as March (3) instead of April. What
> could I be doing wrong?
>
> Thanks in Advance

Check the docs: the months go from 0..11 in localtime.

Aloha => Beau;


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to