DT_TO_VAR

The DT_TO_VAR procedure converts a date/time variable to numerical data.

Calling Sequence

DT_TO_VAR, Dt_var

Arguments

Dt_var

A date/time variable.

Keywords

DAY

Set this keyword to a byte variable containing the days.

HOUR

Set this keyword to a byte variable containing the hours.

MINUTE

Set this keywork to a byte variable containing the minutes.

MONTH

Set this keyword to a byte variable containing the months.

SECOND

Set this keyword to a floating-point variable containing the seconds and fractional seconds.

YEAR

Set this keyword to an integer variable containing the years.

Example

Assume the date/time variable date1 contains the following date/time data:

date1=[ $

{IDLDT, 1971,6,23,15,52,15.000,87474.440,0}, $

{IDLDT, 1970,9,4,10,30,19.000,84224.521,0}, $

{IDLDT, 1969,10,8,4,25,14.000,77350.684,0}, $

{IDLDT, 1977,6,18,10,42,19.000,84224.521,0}]

 

To extract each date/time element into a separate variable, enter:

DT_TO_VAR, date1, YEAR=years, MONTH=months, DAY=days
years; is an integer variable, while months; and days; are byte
variables.

PRINT, "Years = ", years

PRINT, "Months = ", months

PRINT, "Days = ", days

IDL prints:

% Compiled module: DT_TO_VAR.

Years = 1971 1970 1969 1977

Months = 6 9 10 6

Days = 23 4 8 18

See Also

VAR_TO_DT, IDLDT__DEFINE