On 8/29/06, Practical Perl <[EMAIL PROTECTED]> 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. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>