Converts date andtime string data to date/time values.
time_strings (optional) A string constant or string array that contains time strings.
Value | Format Description | Examples for May 1, 1992 |
---|---|---|
1 | MM*DD*[YY]YY | 05/01/92 |
2 | DD*MM*[YY]YY | 01-05-92 |
3 | ddd*[YY]YY | 122,1992 |
4 | DD*mmm[mmmmmm]*[YY]YY | 01/May/92 |
5 | [YY]YY*MM*DD | 1992-05-01 |
Time_Fmt Specifies the format of the time portion of the data in the input variable. Possible values are -1 or -2, as summarized in the following table:
Value | Format Description | Examples for 1:30 p.m. |
---|---|---|
-1 | HH*Mn*SS[.SSSS] | 13:30:35.25 |
-2 | HHMn | 1330 |
For a detailed description of the date and time formats, see Converting Your Data into Date/Time Data in Chapter 8 of the PV-WAVE User's Guide.
CAUTION: Date and time separators are specified with the !Date_Separator and !Time_Separator system variables. The STR_TO_DT function only recognizes the standard separators listed above. If any other separator is specified, this function does not work as expected.
x = ['3-13-92', '4-20-83', '4-24-64']
y = ['1:10:34', '16:18:30', '5:07:25']
date1 = STR_TO_DT(x, y, Date_Fmt=1, Time_Fmt =-1)
DT_PRINT, date1
3/13/1992 01:10:34
4/20/1983 16:18:30
4/24/1964 05:07:25
date2 = STR_TO_DT('3-13-92', Date_Fmt=1) PRINT, date2
{ 1992 3 13 0 0 0.00000 87474.000 0 }
For more information on using date/time functions, see Chapter 8, Working with Date/Time Data, in thePV-WAVE User's Guide.