CALDAT

The CALDAT procedure computes the month, day, year, hour, minute, or second corresponding to a given Julian date. The inverse of this procedure is JULDAY.

This routine is written in the IDL language. Its source code can be found in the file caldat.pro in the lib subdirectory of the IDL distribution.

Calling Sequence

CALDAT, Julian, Month, Day, Yea r, Hour, Minute, Secon d

Arguments

Julian

A numeric value or array that specifies the Julian Day Number (which begins at noon) to be converted to a calendar date.

Month

A named variable that, on output, contains the number of the desired month (1 = January, ..., 12 = December).

Day

A named variable that, on output, contains the number of the day of the month (1-31).

Year

A named variable that, on output, contains the number of the desired year (e.g., 1994).

Hour

A named variable that, on output, contains the number of the hour of the day (0-23).

Minute

A named variable that, on output, contains the number of the minute of the day (0-1439).

Second

A named variable that, on output, contains the number of the second of the day
(0-86399).

Examples

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

IDL prints:

10    4    1582

Be sure to distinguish between Month and Minute when assigning variable names:

CALDAT, 2529161.36, M, D, Y, H, M, S ; Find date corresponding to Julian day 2529161.36.

CALDAT, 2529161.36, Month, Day, Year, Hour, Minute, Second

PRINT, M, D, Y, H, M, S

PRINT, Month, Day, Year, Hour, Month, Second

IDL prints:

9 19 1938 6 0 0.0000000
; This is the correct value,
September 19, 1938.

9 19 1938 6 9 0.0000000

; The Minute value is incorrect; it is the same as the Month value.

You can use arrays for the Julian argument:

CALDAT,FINDGEN(4)+2449587L, m, d, y

PRINT, m, d, y

IDL prints:

8 8 8 8

22 23 24 25

1994 1994 1994 1994

See Also

BIN_DATE , JULDAY , SYSTIME