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'
            
, 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:

  • YYYY is the four-digit year
  • MM is the two-digit month
  • DD is the two-digit day
  • T separates the date and time
  • HH is the two-digit hour
  • MM is the two-digit minute
  • SS is the two-digit second
  • D is the decimal fraction of a second with up to double-precision
  • Z indicates Coordinate Universal Time (UTC)
  • oo is a two-digit offset in hours from UTC time. If the offset is negative, a minus symbol (-) precedes the value. If it is positive, a plus symbol (+) precedes the value.
  • mm is an optional partial-hour offset (in minutes) from UTC time

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