FAQ 4.16 How can I find the Julian Day?
  Home FAQ Contact Sign in
comp.lang.perl.misc only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.perl.misc Profile…
 Up
FAQ 4.16 How can I find the Julian Day?         


Author: PerlFAQ Server
Date: May 6, 2008 18:03

This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

4.16: How can I find the Julian Day?

(contributed by brian d foy and Dave Cross)

You can use the "Time::JulianDay" module available on CPAN. Ensure that
you really want to find a Julian day, though, as many people have
different ideas about Julian days. See
http://www.hermetic.ch/cal_stud/jdn.htm for instance.

You can also try the "DateTime" module, which can convert a date/time to
a Julian Day.

$ perl -MDateTime -le'print DateTime->today->jd'
2453401.5

Or the modified Julian Day

$ perl -MDateTime -le'print DateTime->today->mjd'
53401
Show full article (1.77Kb)
no comments