Converts date and time values to Excel timestamps.
DT2EXCEL(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. |
DT2EXCEL(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 Excel timestamps.
edt = dt2excel("1/1/2021", "12:00:00");
dte = excel2dt(edt);
edt == 44197.5
dte == "1/1/2021 12:00:00.000"
W1: {julstr("1-1-1999"), julstr("1-10-1999"), julstr("4-2-1999")}
W2: {todstr("12:00"), todstr("14:00"), todstr("9:35")}
W3: dt2excel(w1, w2)
W4: excel2dt(w3)
W3 == {36161.5, 36170.583333, 36252.399306}
W4 contains the datetime values:
01/01/1999 12:00:00.000
01/10/1999 14:00:00:000
04/02/1999 9:35:00.000
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: ravel(w1, w2)
W4: dt2excel(w3)
W5: excel2dt(w4)
Similar to above, except the input values in W3 are provided in datetime series format.
W4 == {36161.5, 36170.583333, 36252.399306}
Both W3 and W5 contain the datetime values:
01/01/1999 12:00:00.000
01/10/1999 14:00:00:000
04/02/1999 9:35:00.000
An EXCEL timestamp is a real value that represents the number of days that have elapsed since 12-30-1899. 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.
See EXCEL2DT to convert a series of Excel timestamps to a datetime series.