Converts date and time values to Unix timestamps.
DT2UNIX(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. |
DT2UNIX(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. |
A scalar or series of Unix timestamps.
udt = dt2unix("1/1/2028", "12:00:00");
dtu = unix2dt(udt);
udt == 1830340800.0
dtu == "1/01/2028 12:00:00"
W1: {julstr("1/1/1999"), julstr("1/10/1999"), julstr("4/2/1999")};setvunits("Date")
W2: {todstr("12:00"), todstr("14:00"), todstr("9:35")};setvunits("Time")
W3: dt2unix(w1, w2)
W4: unix2dt(w3)
W1 contains Julian date values.
W2 contains time of day (TOD) time values.
W3 converts the date and time values to Unix timestamps producing the timestamp series:
{915192000.0, 915976800.0, 923045700.0}
W4 converts the Unix timestamps in W3 to the datetime series:
01/01/1999 12:00:00
01/10/1999 14:00:00
04/02/1999 9:35:00
W1: {{2030, 10, 30, 18, 0, 0},
{2030, 10, 31, 0, 0, 0},
{2030, 10, 31, 6, 0, 0},
{2030, 10, 31, 12, 0, 0}};
W2: ymdhms2dt(w1)
W3: dt2unix(w2)
W4: unix2dt(w3)
W1 contains raw date time values in year, month, date, hours, minutes, seconds format.
W2 converts the raw YMDHMS values in W1 to datetime values. W2 contains the datetime series:
10/30/2030 18:00:00
10/31/2030 00:00:00
10/31/2030 06:00:00
10/31/2030 12:00:00
W3 converts the datetime values of W2 into Unix timestamps. W3 contains the values:
{1919613600.0,
1919635200.0,
1919656800.0,
1919678400.0}
W4 converts the Unix timestamps in W3 to a datetime series. W4 contains the same datetime values as W2:
10/30/2030 18:00:00
10/31/2030 00:00:00
10/31/2030 06:00:00
10/31/2030 12:00:00
A Unix timestamp is a real value that represents the number of seconds elapsed since midnight January 1, 1970 UTC time. The integer part is the whole number of days and the fractional part is the fraction of a day.
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.
Time of day (TOD) value is the number of seconds elapsed since midnight of a day.
See UNIX2DT to convert Unix timestamps to a datetime series.
See DT2TIMESTAMP to convert datetime values to internal timestamps suitable for date time arithmetic.