www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/FindHourMinuteAndSecondNumbersOfDatetimeArrayExample.m

    %% Find Hour, Minute, and Second Numbers of datetime Array
%%

% Copyright 2015 The MathWorks, Inc.

t1 = datetime('now','Format','HH:mm:ss.SSS');
t = t1 + minutes(0:45:135)

[h,m,s] = hms(t)
%%
% |hms| returns the hour, minute, and second numbers in separate arrays.