in reply to How do I convert a julian date?
It doesn't actually sound like those are Julian dates that you've got there(1), but days of the year.
Assuming that I'm right, you could try something like this:
use Time::Local; my $date = '00250'; my ($yr, $day) = unpack('A2A3', $yr); # Ugly hack to get round the fact that you have # two digit dates. Adjust cutoff to taste. $yr += 100 if $yr < 70; # Get epoch time at start of year. my $when = timelocal(0, 0, 0, 1, 0, $yr); # Increment by number of days $when += 86_400 * $day; # Convert back to MMDD my ($d, $m) = (localtime($when))[3, 4]; ++$m; sprintf('%02d%02d', $d, $m);
(1) See http://www.treasure-troves.com/astro/JulianDate.html for more stuff about Julian dates.
--
"Perl makes the fun jobs fun
and the boring jobs bearable" - me
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(RhetTbull) Re: Re: How do I convert a julian date?
by RhetTbull (Curate) on Dec 05, 2000 at 19:35 UTC | |
by Anonymous Monk on Oct 19, 2004 at 13:22 UTC |