datetime.second
datetime: s = second (T)
datetime: s = second (T, secondType)
Seconds component of a datetime array.
s = second (T) returns the number of seconds for each
element of the input datetime array T. The output s is a
double array containing values in the range ,
including any fractional part of the second, and it has the same size as
T. Not-A-Time (NaT) values in T are returned as
NaN in the output array.
s = second (T, secondType) returns the seconds
for each element of the input datetime array T as specified by
secondType, which may have any of the following options:
'secondofminute' (default) returns the second of the minute
in a numeric array, in the range .
'secondofday' returns the second of the day in a numeric
array, in the range .
Source Code: datetime
second returns the seconds of the minute by default, or the seconds elapsed since midnight with 'secondofday'.
t = datetime (2024, 3, 9, 14, 30, 45)
t = datetime 09-Mar-2024 14:30:45
second (t)
ans = 45
second (t, 'secondofday')
ans = 52245