s = second( returns the second
values, including a fractional part, for the datetime values in
s output is a
double array the same size as
contains values from 0 to less than 60.
For datetime values whose time zone is
s output can contain a value between 60 and 61 for times
that fall during a leap second occurrence.
t1 = datetime('now','Format','dd-MMM-yyyy HH:mm:ss.SSS'); t = t1 + seconds(30:15:60)
t = 1x3 datetime array Columns 1 through 2 26-Aug-2019 11:05:02.550 26-Aug-2019 11:05:17.550 Column 3 26-Aug-2019 11:05:32.550
s = second(t)
s = 1×3 2.5509 17.5509 32.5509
secondType— Type of second values
Type of second values, specified as either
second returns the second of the
second returns the second of the day,
which (except for leap seconds) is in the range [0,
This function fully supports tall arrays. For more information, see Tall Arrays.
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).