DATE_CONV
Name
DATE_CONV
Purpose
Procedure to perform conversion of dates to one of three possible formats.
Explanation
The following date formats are allowed
format 1: real*8 scalar encoded as:
year*1000 + day + hour/24. + min/24./60 + sec/24./60/60
where day is the day of year (1 to 366)
format 2: Vector encoded as:
date[0] = year (eg. 2005)
date[1] = day of year (1 to 366)
date[2] = hour
date[3] = minute
date[4] = second
format 3: string (ascii text) encoded as
DD-MON-YEAR HH:MM:SS.SS
(eg. 14-JUL-2005 15:25:44.23)
OR
YYYY-MM-DD HH:MM:SS.SS (ISO standard)
(eg. 1987-07-14 15:25:44.23 or 1987-07-14T15:25:44.23)
format 4: three element vector giving spacecraft time words
from a Hubble Space Telescope (HST) telemetry packet. Based on
total number of secs since midnight, JAN. 1, 1979
format 5: Julian day. As this is also a scalar, like format 1,
the distinction between the two on input is made based on their
value. Numbers > 2300000 are interpreted as Julian days.
Calling Sequence
results = DATE_CONV( DATE, TYPE )
Inputs
DATE - input date in one of the possible formats. Must be scalar.
TYPE - type of output format desired. If not supplied then
format 3 (real*8 scalar) is used.
valid values:
'REAL' - format 1
'VECTOR' - format 2
'STRING' - format 3
'FITS' - YYYY-MM-DDTHH:MM:SS.SS'
'JULIAN' - Julian date
'MODIFIED' - Modified Julian date (JD-2400000.5)
TYPE can be abbreviated to the single character strings 'R',
'V', 'S', 'F', 'J', and 'M'.
Nobody wants to convert TO spacecraft time (I hope!)
Outputs
The converted date is returned as the function value.
Examples
IDL> print,date_conv('2006-03-13 19:58:00.00'),f='(f15.5)'
2006072.83194
IDL> print,date_conv( 2006072.8319444d,'F')
2006-03-13T19:58:00.00
IDL> print,date_conv( 2006072.8319444d,'V')
2006.00 72.0000 19.0000 57.0000 59.9962
IDL> print,date_conv( 2006072.8319444d,'J'), f='(f15.5)'
2453808.33194
History
version 1 D. Lindler July, 1987
adapted for IDL version 2 J. Isensee May, 1990
Made year 2000 compliant; allow ISO format input jls/acc Oct 1998
DJL/ACC Jan 1998, Modified to work with dates such as 6-JAN-1996 where
day of month has only one digit.
DJL, Nov. 2000, Added input/output format YYYY-MM-DDTHH:MM:SS.SS
Replace spaces with '0' in output FITS format W.Landsman April 2006
Added Julian date capabilities on input and output. M.Perrin, July 2007
Removed spurious /WARN keyword to MESSAGE W.L. Feb 2012