Is there a better way to convert a DateTime object to Julian days than something like this:
$jd = GregorianToJD( $dt->format('n'), $dt->format('j'), $dt->format('Y') );
I'm a little surprised that there is no function to do this directly or a format specifier to print it. Am I missing something?
Edit:. Many of the (somewhat sarcastic) answers below seem to suggest that the Julian day number is somehow related to the long-obsolete Julian calendar. This is not true. Julian day number is one of the most common ways to number days from a fairly arbitrary era. Its main use is in astronomy, where it is the standard way to determine the date.
php
Richard Smith
source share