Re: Time::Local let me faint
- From: a.r.ferreira@xxxxxxxxx (Adriano Ferreira)
- Date: Tue, 29 Aug 2006 13:55:14 -0300
On 8/29/06, Practical Perl <practicalperl@xxxxxxxxx> wrote:
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.
from "perldoc Time::Local"
It is worth drawing particular attention to the expected ranges for the
values provided. The value for the day of the month is the actual day
(ie 1..31), while the month is the number of months since January
(0..11). This is consistent with the values returned from localtime()
and gmtime().
That means
$ perl -Mstrict -MTime::Local -le 'print timelocal(0,0,0,31,8,2006)'
Day '31' out of range 1..30 at -e line 1
is trying to get "31/Sep/2006" which does not exist
$ perl -Mstrict -MTime::Local -le 'print timelocal(0,0,0,31,7,2006)'
1156953600
is getting "31/Aug/2006" which is alright.
Regards,
Adriano Ferreira.
.
- 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: Time::Local let me faint
- Next by thread: Re: Time::Local let me faint
- Index(es):
Relevant Pages
|
|