The CDF_ENCODE_EPOCH function encodes a CDF_EPOCH variable into a string. Four different string formats are available. The default (EPOCH=0) is the standard CDF format, which may be parsed by the CDF_PARSED_EPOCH function or broken down with the CDF_EPOCH procedure.
Result = CDF_ENCODE_EPOCH(Epoch [, EPOCH={0 | 1 | 2 | 3}] )
Returns a string containing the encoded CDF_EPOCH variable.
The double-precision CDF_EPOCH value to be encoded. For more information about CDF_EPOCH values, see “Data Types” in the CDF User’s Guide.
Set this keyword equal to one of the following integer values, specifying the epoch mode to use for output of the epoch date string:
Value |
Date Format |
0 |
DD-Mon-YYYY hh:mm:ss.ccc
|
1 |
YYYYMMDD.ttttttt |
2 |
YYYYMMDDhhmmss |
3 |
YYYY-MM-DDThh:mm:ss.cccZ
|
where:
Date Element |
Represents |
DD |
the day of the month (1-31) |
Mon |
the abbreviated month name: (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, or Dec) |
MM |
the month number (1-12) |
YYYY |
the year (A.D.) |
hh |
the hour (0-23) |
mm |
the minute (0-59) |
ss |
the second (0-59) |
ccc |
the millisecond (0-999) |
ttttttt |
the fraction of the day (e.g. 2500000 is 6 am). |
epoch_string = '04-Dec-1995 20:19:18.176'
epoch = CDF_PARSE_EPOCH(epoch_string)
HELP, epoch_string, epoch
; Create encode strings:
encode0 = CDF_ENCODE_EPOCH(epoch, EPOCH=0)
encode1 = CDF_ENCODE_EPOCH(epoch, EPOCH=1)
encode2 = CDF_ENCODE_EPOCH(epoch, EPOCH=2)
encode3 = CDF_ENCODE_EPOCH(epoch, EPOCH=3)
; Compare encoding formats:
HELP, encode0, encode1, encode2, encode3
EPOCH_STRING STRING = '04-Dec-1995 20:19:18.176'
EPOCH DOUBLE = 6.2985328e+13
ENCODE0 STRING = '04-Dec-1995 20:19:18.176'
ENCODE1 STRING = '19951204.8467381'
ENCODE2 STRING = '19951204201918'
ENCODE3 STRING = '1995-12-04T20:19:18.176Z'
4.0.1b |
Introduced |