timeofday
Elapsed time since midnight fordatetime
arrays
Description
返回一个T
= timeofday(DT
)duration
array whose values equal the elapsed time since midnight for each element inDT
.
Fordatetime
arrays without time zones, and in most other cases,T
is equal to
E = hours(DT.Hour) + minutes(DT.Minute) + seconds(DT.Second)
IfDT
has itsTimeZone
property set to a time zone that respects Daylight Saving Time (DST), thentimeofday
takes DST into account. For more information, seeAlgorithms.
The output argumentT
is also equivalent toDT - dateshift(DT,'start','day')
.
Examples
Input Arguments
Output Arguments
Algorithms
Adatetime
array can have itsTimeZone
property set to a time zone that observes Daylight Saving Time (DST). Thetimeofday
function takes DST into account.
If the input argument
DT
is adatetime
array with no time zone, then the outputT
is also equal toE = hours(DT.Hour) + minutes(DT.Minute) + seconds(DT.Second)
If
DT
has itsTimeZone
property set to a time zone that does not observe DST, thenT
is equal toE
.If
DT
has itsTimeZone
property set to a time zone that observes DST, thentimeofday
accounts for the DST shift on days when the shift occurs. On those days, for times after the DST shift occurs,T
differs fromE
by the amount of the shift.