In Time::Local, to match perl's internal localtime(), months start at zero. So 
you're trying for April 31st. 

Cheers!
Rick Measham


On 15/04/2011, at 9:39, "Nithi, Nachi K (Karun)" <ka...@research.bell-labs.com> 
wrote:

> Example code:
> 
> #!/usr/bin/perl -w
> select(STDOUT); $| = 1; # make unbuffered
> 
> use Time::Local;
> 
> $tdate = "31/03/2011";
> $ttime = "14:49:59";
> $mday  = $mon = $year = 0;
> $hour = $min = $sec = 0;
> 
> ($mday,$mon,$year) = split('/',$tdate);
> ($hour,$min,$sec)  = split(':',$ttime);
> print "mday =  $mday \tmon = $mon\tyear = $year\n";
> print "hour =  $hour \tmin = $min\tsec = $sec\n";
>        $uxtsec = timelocal($sec,$min,$hour,$mday,$mon,$year);
> print "timelocal_sec = $uxtsec\n";
> #-------------------------------------------------------------------#
> 
> Result:
> 
> $ ./tl.pl
> mday =  31      mon = 03        year = 2011
> hour =  14      min = 49        sec = 59
> 
> Error:       Day '31' out of range 1..30 at ./tl.pl line 15
> 
> 
> Is there a bug? The 'mday' range in the doc says 1..31 and it is 31 here. But 
> complains about out of range.
> 
> 
> Thanks,
> 
> 
> Dr. Nachi Nithi
> Bell-Labs, Alcatel-Lucent
> 2C-323, Mountain Ave.,
> Murray Hill, NJ 07974
> Ph: 908-582-3590
> Home: 
> http://ect.bell-labs.com/who/karun//index.html<http://ect.bell-labs.com/who/karun/index.html>
> -------------------------------------------------------------------------------------------------------------------------------------------------
> 
> 
> -- 
> Message  protected for iSite by MailGuard: e-mail anti-virus, anti-spam and 
> content filtering.http://www.mailguard.com.au
> Click here to report this message as spam:
> https://login.mailguard.com.au/report/1C7jlMg48w/FTZOfbEeOXsCvNVcE9ife/0
> 
-- 
Message  protected for iSite by MailGuard: e-mail anti-virus, anti-spam and 
content filtering.http://www.mailguard.com.au

Reply via email to