date handle

$ perl -MTime::Local -le 'print timelocal(0,0,0,1,1,1900)'
Cannot handle date (0, 0, 0, 1, 1, 1900) at -e line 1


why Time::Local can't handle the date of 1900?

Thanks.

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
pyh [ Mo, 31 Januar 2011 03:34 ] [ ID #2054253 ]

Re: date handle

pyh [at] mail.nsbeta.info wrote:
> $ perl -MTime::Local -le 'print timelocal(0,0,0,1,1,1900)'
> Cannot handle date (0, 0, 0, 1, 1, 1900) at -e line 1
>
> why Time::Local can't handle the date of 1900?

Unix time starts at 1 Jan. 1970 so a time in 1900 is invalid.



John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction. -- Albert Einstein

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
jwkrahn [ Mo, 31 Januar 2011 07:17 ] [ ID #2054257 ]

Re: date handle

At 22:17 -0800 30/01/2011, John W. Krahn wrote:


>pyh [at] mail.nsbeta.info wrote:
>>$ perl -MTime::Local -le 'print timelocal(0,0,0,1,1,1900)'
>>Cannot handle date (0, 0, 0, 1, 1, 1900) at -e line 1
>>
>>why Time::Local can't handle the date of 1900?
>
>Unix time starts at 1 Jan. 1970 so a time in 1900 is invalid.

Time for someone to RTFM I think!
<http://perldoc.perl.org/Time/Local.html>

#!/usr/local/bin/perl
use Time::Local 'timelocal_nocheck';
print scalar localtime timelocal_nocheck 0,0,0,1,1,1900;

JD


--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
John Delacour [ Mo, 31 Januar 2011 17:39 ] [ ID #2054260 ]
Perl » gmane.comp.lang.perl.beginners » date handle

Vorheriges Thema: help with zip files and file sizes
Nächstes Thema: parse arguments passed to subroutines