CDF_ENCODE_EPOCH

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.

Calling Sequence

Result = CDF_ENCODE_EPOCH( Epoch )

Arguments

Epoch

The double-precision CDF_EPOCH value to be encoded. For more information about CDF_EPOCH values, see section 2.2.10 ("Data Types") of the version 2.6 CDF User's Guide .

Keyword

EPOCH

Set this keyword to indicate the type of output desired,

Set EPOCH=0 to select output of the standard type, which is described in CDF_PARSE_EPOCH.

Set EPOCH=1 to select output of the type yyyymodd.ttttttt where: yyyy is the year, mo is the month (1-12), dd is the day of the month (1-31), and ttttttt is the fraction of the day (e.g. 2500000 at 6 am).

Set EPOCH=2 to select output of the type yyyymoddhhmmss where: yyyy is the year, mo is the month (1-12), dd is the day of the month (1-31), hh is the hour (0-23), mm is the minute (0-59), and ss is the second (0-59).

Set EPOCH=3 to select output of the type yyyy-mo-ddThh:mm:ss.cccZ where: yyyy is the year, mo is the month (1-12), dd is the day of the month (1-31), hh is the hour (0-23), mm is the minute (0-59), ss is the second (0-59), and ccc is the millisecond (0-999). The characters T and Z are the CDF_EPOCH type 3 place holders.

Example

epoch_string = '04-Dec-1995 20:19:18.176'

epoch = CDF_PARSE_EPOCH(epoch_string)

HELP, epoch_string, epoch

IDL prints:

EPOCH_STRING    STRING = '04-Dec-1995 20:19:18.176'

EPOCH           DOUBLE = 6.2985328e+13

Create encode strings:

encode0 = CDF_ENCODE_EPOCH(test_epoch, EPOCH=0)

encode1 = CDF_ENCODE_EPOCH(test_epoch, EPOCH=1)

encode2 = CDF_ENCODE_EPOCH(test_epoch, EPOCH=2)

encode3 = CDF_ENCODE_EPOCH(test_epoch, EPOCH=3)

Compare encoding formats:

HELP, encode0, encode1, encode2, encode3

IDL prints:

ENCODE0 STRING = '04-Dec-1995 20:19:18.176'

ENCODE1 STRING = '19951204.8467381'

ENCODE2 STRING = '19951204201918'

ENCODE3 STRING = '1995-12-04T20:19:18.176Z'

See Also

CDF_EPOCH , CDF_PARSE_EPOCH