The JULDAY function calculates the Julian Day Number (which begins at noon) for the specified date. This is the inverse of the CALDAT procedure.
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.
Result = JULDAY(Month, Day, Year, Hour, Minute, Second)
Result is of type double-precision if Hour, Minute, or Second is specified, otherwise Result is of type long integer. If all arguments are scalar, the function returns a scalar. If all arguments are arrays, the function matches up the corresponding elements of the arrays, returning an array with the same dimensions as the smallest array. If the inputs contain both scalars and arrays, the function uses the scalar value with each element of the arrays, and returns an array with the same dimensions as the smallest input array.
Number of the desired month (1 = January, ..., 12 = December). Month can be either a scalar or an array.
Number of the day of the month (1-31). Day can be either a scalar or an array.
Number of the desired year (e.g., 1994). Year can be either a scalar or an array.
Number of the hour of the day (0-23). Hour can be either a scalar or an array.
Number of the minute of the hour (0-59). Minute can be either a scalar or an array.
Number of the second of the minute (0-59). Second can be either a scalar or an array.
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)
2299160 2299161 2299161
Using arrays, this can also be calculated as follows:
PRINT, JULDAY(10, [4, 5, 15], 1582)
If you are using JULDAY to calculate an absolute number of days elapsed, be sure to account for the Gregorian adjustment.
BIN_DATE, CALDAT, SYSTIME