CALDAT procedure computes
the month, day, year, hour, minute, or second corresponding to a given Julian date. The inverse of this procedure is JULDAY.
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
subdirectory of the IDL distribution.
Julian, Month, Day, Yea
r, Hour, Minute, Secon
A numeric value or array that specifies the Julian Day Number (which begins at noon) to be converted to a calendar date.
can be of any numeric value, CALDAT will convert all values to longword integer, retaining the same dimensionality.
A named variable that, on output, contains the number of the desired month (1 = January, ..., 12 = December).
A named variable that, on output, contains the number of the day of the month (1-31).
A named variable that, on output, contains the number of the desired year (e.g., 1994).
A named variable that, on output, contains the number of the hour of the day (0-23).
A named variable that, on output, contains the number of the minute of the day (0-1439).
A named variable that, on output, contains the number of the second of the day
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. CALDAT follows this convention, as illustrated by the following commands:
CALDAT, 2299160, Month, Day, Year
PRINT, Month, Day, Year
10 4 1582
You should be aware of this discrepancy between the original and revised Julian calendar reckonings if you calculate dates before October 15, 1582.
Be sure to distinguish between
when assigning variable names:
CALDAT, 2529161.36, M, D, Y, H, M, S
CALDAT, 2529161.36, Month, Day, Year, Hour, Minute, Second
PRINT, M, D, Y, H, M, S
PRINT, Month, Day, Year, Hour, Month, Second
9 19 1938 6 0 0.0000000
9 19 1938 6 9 0.0000000
You can use arrays for the
CALDAT,FINDGEN(4)+2449587L, m, d, y
PRINT, m, d, y
8 8 8 8
22 23 24 25
1994 1994 1994 1994