in reply to Re^2: Convert dates with Time::Local
in thread Convert dates with Time::Local
Like so:
use Time::Local qw/timegm_nocheck/; my $date_string = "2005301"; # The 301st day of 2005 my ($year,$julian_day) = $date_string =~ /^(\d\d\d\d)(\d\d\d)$/; my $gmt = timegm_nocheck 0,0,0,$julian_day,0,$year; # ... do something with the gmt value
Way back in the days of perl4, timelocal.pl (from whence Time::Local is derived) did no validation of the numbers since it is a straight numeric calculation that does not depend on how many days there are in a given month or how many hours in a day, etc. timegm_nocheck and timelocal_nocheck implement the modern-day equivalents of this idea.
But, you'd know this if you'd read the documentation
|
|---|