6.11 Date and Time Utility Routines
The following routines help to construct or parse the FITS date/time
strings. Starting in the year 2000, the FITS DATE keyword values (and
the values of other `DATE-' keywords) must have the form 'YYYY-MM-DD'
(date only) or 'YYYY-MM-DDThh:mm:ss.ddd...' (date and time) where the
number of decimal places in the seconds value is optional. These times
are in UTC. The older 'dd/mm/yy' date format may not be used for dates
after 01 January 2000.
- 1
- Get the current system date. The returned year has 4 digits
(1999, 2000, etc.)
FTGSDT( > day, month, year, status )
- 2
- Get the current system date and time string ('YYYY-MM-DDThh:mm:ss').
The time will be in UTC/GMT if available, as indicated by a returned timeref
value = 0. If the returned value of timeref = 1 then this indicates that
it was not possible to convert the local time to UTC, and thus the local
time was returned.
FTGSTM(> datestr, timeref, status)
- 3
- Construct a date string from the input date values. If the year
is between 1900 and 1998, inclusive, then the returned date string will
have the old FITS format ('dd/mm/yy'), otherwise the date string will
have the new FITS format ('YYYY-MM-DD'). Use FTTM2S instead
to always return a date string using the new FITS format.
FTDT2S( year, month, day, > datestr, status)
- 4
- Construct a new-format date + time string ('YYYY-MM-DDThh:mm:ss.ddd...').
If the year, month, and day values all = 0 then only the time is encoded
with format 'hh:mm:ss.ddd...'. The decimals parameter specifies how many
decimal places of fractional seconds to include in the string. If `decimals'
is negative, then only the date will be return ('YYYY-MM-DD').
FTTM2S( year, month, day, hour, minute, second, decimals,
> datestr, status)
- 5
- Return the date as read from the input string, where the string may be
in either the old ('dd/mm/yy') or new ('YYYY-MM-DDThh:mm:ss' or
'YYYY-MM-DD') FITS format.
FTS2DT(datestr, > year, month, day, status)
- 6
- Return the date and time as read from the input string, where the
string may be in either the old or new FITS format. The returned hours,
minutes, and seconds values will be set to zero if the input string
does not include the time ('dd/mm/yy' or 'YYYY-MM-DD') . Similarly,
the returned year, month, and date values will be set to zero if the
date is not included in the input string ('hh:mm:ss.ddd...').
FTS2TM(datestr, > year, month, day, hour, minute, second, status)