Re: Time::Local let me faint
- From: dsl58893@xxxxxxxxxxxxxxxx (Flemming Greve Skovengaard)
- Date: Tue, 29 Aug 2006 18:58:37 +0200
Practical Perl wrote:
Hello,lists,
Please see these two lines' output:
[$ perl -Mstrict -MTime::Local -le 'print timelocal(0,0,0,31,8,2006)'
Day '31' out of range 1..30 at -e line 1
$ perl -Mstrict -MTime::Local -le 'print timelocal(0,0,0,31,7,2006)'
1156953600
I translate the time of '2006-7-31 00:00:00' to unix timestamp,it's
successful.
But when I translate the time of '2006-8-31 00:00:00' to unix timestamp,it
said '31 out of range'.
I'm so faint that August doesn't have 31th day?Please tell me why this
happen and how to resolve it.
Thank you very much.
I believe it is because the months are 0-indexed (0-11), so timelocal(0,0,0,31,8,2006) is 2006-7-31 *not* 2006-8-31.
It also say so in the documentation.
perldoc Time::Local
Hope it helps.
--
Flemming Greve Skovengaard The killer's breed or the Demon's seed,
a.k.a Greven, TuxPower The glamour, the fortune, the pain,
<dsl58893@xxxxxxxxxxxxxxxx> Go to war again, blood is freedom's stain,
4011.74 BogoMIPS Don't you pray for my soul anymore.
.
- References:
- Time::Local let me faint
- From: Practical Perl
- Time::Local let me faint
- Prev by Date: Re: Time::Local let me faint
- Next by Date: Re: Time::Local let me faint
- Previous by thread: Re: Time::Local let me faint
- Next by thread: Re: Time::Local let me faint
- Index(es):