VAR_TO_DT

The VAR_TO_DT function converts scalar or array values representing dates and times to date/time variables. The result is an IDLDT date/time variable containing the converted values.

Use this function to create date/time variables from time stamp data that do not conform to the format used by the STR_TO_DT function. For example, you can read the date and time data into atomic variables representing each of the date and time elements (i.e., year, month, day, etc.). Then the variables can be converted to date/time variables using VAR_TO_DT.

If the year, month, and day values are all zero, then the value of the !DT_BASE system variable is used for the date portion of the resulting date/time variable. The parameters can be arrays of any numeric values, but all parameters must have the same dimension; that is, the parameters must be either all scalars or all arrays of the same size. You can only omit parameters from the end of the parameter list.

Calling Sequence

Result = VAR_TO_DT( Yyyy, Mm, Dd, Hh, Min, Ss )

Arguments

Yyyy

A scalar or array containing years. The default is 4713 BC.

Mm

A scalar or array containing months. The default is 1.

Dd

A scalar or array containing days. The default is 1.

Hh

A scalar or array containing hours. The default is zero.

Min

A scalar or array containing minutes. The default is zero.

Ss

A scalar or array containing seconds. The default is zero.

Example

This example illustrates how to convert a single date value into a date/time variable.

z = VAR_TO_DT(1977, 6, 18, 10, 42) ; Creates a date/time variable containing June 18, 1971 at 10:52. Note that seconds have been omitted.

PRINT, z

IDL prints:

{ 1977 6 18 10 42 0.00000 2443313.4 0}

See Also

IDLDT__DEFINE