The JULDAY function calculates the Julian Day Number for a given month, day, and year. This is the inverse of the CALDAT procedure. JULDAY returns the Julian Day Number (which begins at noon) of the specified calendar date.
NOTE: The Julian calendar, established by Julius Caesar in the year 45 BCE, was corrected by Pope Gregory XIII in 1582, excising ten days from the calendar. The CALDAT procedure reflects the adjustment for dates after October 4, 1582. See the example below for an illustration.
This routine is written in the IDL language. Its source code can be found in the file
julday.pro
in the
lib
subdirectory of the IDL distribution.
In 1582, Pope Gregory XIII adjusted the Julian calendar to correct for its inaccuracy of slightly more than 11 minutes per year. As a result, the day following October 4, 1582 was October 15, 1582. JULDAY follows this convention, as illustrated by the following commands:
PRINT, JULDAY(10,4,1582), JULDAY(10,5,1582), JULDAY(10,15,1582)
If you are using JULDAY to calculate an absolute number of days elapsed, be sure to account for the Gregorian adjustment.