TIMESTAMPTOVALUES

The TIMESTAMPTOVALUES procedure passes through the year, month, day, hour, minute, second, and offset from Coordinated Universal Time (UTC), given a date/time string in ISO-8601 format. This function is the inverse to TIMESTAMP.

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

Example

The following example takes a date/time string in ISO-8601 format with an offset of -6 hours from UTC and prints the date/time information.

timestamp_string = '2012-09-04T11:25:15-06:00'

TIMESTAMPTOVALUES, timestamp_string, $

   YEAR=year, MONTH=month, DAY=day, $

   HOUR=hour, MINUTE=minute, $

   SECOND=second, OFFSET=offset

PRINT, month, day, year, hour, minute, second, offset

Result:

9     4      2012     11     25     15.000000     -6.000000

Syntax

TIMESTAMPTOVALUES, Timestamp, DAY=day, HOUR=hour, MINUTE=minute, MONTH=month, OFFSET=offset, SECOND=second, YEAR=year

Arguments

Timestamp

A string or array of strings containing dates/times in ISO-8601 format.

The time stamp can be in any of the following formats:

YYYY-MM-DD

YYYY-MM-DDTHH:MM:SS.DZ

YYYY-MM-DDTHH:MM:SS:Doo:mm

Where:

Keywords

DAY (optional)

A named variable that, upon output, contains a long integer representing the day of the month (1 to 31).

HOUR (optional)

A named variable that, upon output, contains a long integer representing the hour of the day in 24-hour time (0 to 23).

MINUTE (optional)

A named variable that, upon output, contains a long integer representing the number of minutes after the hour (0 to 59).

MONTH (optional)

A named variable that, upon output, contains a long integer representing the month (1 to 12).

OFFSET (optional)

A named variable that, upon output, contains a double-precision value representing the offset in hours from UTC.

SECOND (optional)

A named variable that, upon output, contains a double-precision value representing the number of seconds after the minute.

YEAR (optional)

A named variable that, upon output, contains a long integer representing the four-digit year.

Version History

8.2.2

Introduced

See Also

CALDAT, TIMEGEN, TIMESTAMP