%% Return Date Portions of datetime Array
% Create a datetime array.

DT = datetime('now') + hours(1:3)

%
% Return the date portions of DT as a second datetime array. Because the hour, minute, and second components of D are all set to midnight (or 00:00:00 in 24-hour format), D displays only the dates.

[T,D] = timeofday(DT)

% Copyright 2021 The MathWorks, Inc.