[ILUG] julian dates...
fergal at esatclear.ie
Wed Sep 27 16:49:46 IST 2000
kevin lyda wrote:
> so, using either a libc function or a perl function, how would one
> extract a date (day of month, month, year) from a julian date
> (year, day of year)?
use Time::Local qw( timelocal );
my $year = 2001;
my $day = 60;
my $year_sec = timelocal(0, 0, 0, 1, 0, $year-1900);
my $new_sec = $year_sec + ($day-1) * 60 * 60 *24;
my ($day, $month) = (localtime($new_sec))[3,4];
print "day = $day, month = $month\n";
More information about the ILUG