Reference Guide > D Routines > DT_TO_VAR Procedure
  

DT_TO_VAR Procedure
Standard Library procedure that converts a date/time variable to regular numerical data.
Usage
DT_TO_VAR, dt_var
Input Parameters
dt_varA date/time variable.
Keywords
Year — Specifies an integer variable to contain the years.
Month — Specifies a byte variable to contain the months.
Day — Specifies a byte variable to contain the days of the month.
Hour — Specifies a byte variable to contain the hours.
Minute — Specifies a byte variable contain the minutes.
Second — Specifies a floating-point variable to contain the seconds and fractional seconds.
Discussion
Use one or more keywords to specify the kind of output produced by this procedure. For example, to create a new variable containing the years in the date/time variable mydtvar, use:
DT_TO_VAR, mydtvar, year=myyear
The result is a new variable called myyear that contains integer values.
Example
Assume that you have created a date/time variable named date1 that contains the following date/time data:
date1=[{!dt, 1992,3,13,10,34,15.000,87474.440,0}, $
{!dt, 1983,4,20,12,30,19.000,84224.521,0}, $
{!dt, 1964,6,24,16,25,14.000,77350.684,0}]
 
; To extract each date/time element into a separate variable.
; This procedure creates several variables containing the
; date time data.
DT_TO_VAR, date1, Year=years, Month=months, Day=days
PRINT, 'Years = ', years
; PV-WAVE prints: Years = 1992 1983 1964
PRINT, 'Months = ', months
; PV-WAVE prints: Months = 3 4 6
PRINT, 'Days = ', days
; PV-WAVE prints: Days = 13 20 24
See Also
DT_TO_SEC,   DT_TO_STR,   VAR_TO_DT
For more information on date/time, see the PV‑WAVE User’s Guide.
 
 

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.