Converts date and time values to years, months, days, hours, minutes and seconds.
DT2YMDHMS(date, time, "timezone")
(yr, mo, dy, hr, mn, s) = DT2YMDHMS(date, time, "timezone")
date |
- |
Optional. A string or series of Julian integer dates, the input date. Defaults to the current date. |
time |
- |
Optional. A string or series of time of day values, the input time. Defaults to the current time. |
"timezone" |
- |
Optional. A string, the local time zone. Defaults to the current time zone. If specified, the resulting timestamps are based on UTC time. |
DT2YMDHMS(datetime, "timezone")
(yr, mo, dy, hr, mn, s) = DT2YMDHMS(datetime, "timezone")
datetime |
- |
An array, a datetime series where the date and time values are in adjacent columns. |
"timezone" |
- |
Optional. A string, the local time zone. Defaults to the current time zone. If specified, the resulting timestamps are based on UTC time. |
An N x 6 series of years, months, days, hours, minutes, seconds.
(yr, mo, dy, hr, mn, s) = DT2YMDHMS(date, time, "timezone") returns the values in separate variables.
W1: dt2ymdhms()
W1 contains a 1x6 series with the current date as separate year, month, day, hours, minutes, seconds values.
W2: dt2ymdhms("1/1/2030", "12:30:00")
W2 contains a 1x6 series with the following values:
{{2030, 1, 1, 12, 30, 0}}
(yr, mo, dy, hr, mn, s) = dt2ymdhms("1/1/2030", "12:30:00");
W3: ravel(yr, mo, dy, hr, mn, s)
Same as above, except the years, months, days, hours, minutes and seconds components are returned to separate variables. The variables are combine to produce the series:
{{2030, 1, 1, 12, 30, 0}}
W1: {{2030,1,1,0,0,0},{2031,2,2,2,4,6},{2032,3,3,8,10,12}}
W2: ymdhms2dt(w1)
W3: dt2ymdhms(w2)
W4: all(w1 == w3)
W1 contains a series of raw years, months, days, hours, minutes and seconds values.
W2 converts the raw years, months, days, hours, minutes and seconds values in W1 to a datetime series. W2 contains the datetimes:
1/01/2030 0:00:00
2/02/2030 2:04:06
3/03/2032 8:10:12
W3 converts the datetime values in W2 back into years, months, days, hours, minutes and seconds values.
W4 compares the original years, months, days, hours, minutes and seconds values in W1 to the recovered values in W3. The result is all ones, indicating the two series are equal.
DT2YMDHMS converts a datetime series to a series of years, months, days, hours, minutes and seconds.
A datetime series consists of 2 columns of values where the first column contains integer Julian dates starting at midnight and the second column contains time in seconds starting from midnight.
See YMDHMS2DT to convert a series of years, months, days, hours, minutes, seconds to a datetime series.