On 2010.9.2 7:08 AM, Mark Albert wrote:
> I get an error message for the third "timelocal" command in the short program 
> shown below. The module does not seem to see August 31st as a true date:
> 
> #!c:/strawberry/perl/bin/Perl.exe
> use strict;
> use warnings;
> use Time::Local;
> 
> #time and date:  19:40:00, August 30, 2010.
> my $DATE = timelocal(0,40,19,30,8,2010);
> print "$DATE\n";
> 
> #time and date:  19:40:00, September 1, 2010.
> my $DATE1 = timelocal(0,40,19,1,9,2010);
> print "$DATE1\n";
> 
> #time and date:  19:40:00, August 31, 2010.
> my $DATE2 = timelocal(0,40,19,31,8,2010);
> print "$DATE2\n";

Your months are off by one.  Feed the results back into localtime() to see.

You may now feel silly... but not too silly as counting months from 0 is 
sillier.


-- 
If you want the truth to stand clear before you, never be for or against.
The struggle between "for" and "against" is the mind's worst disease.
    -- Sent-ts'an

Reply via email to