%% Differences Between Two Datetime Arrays
% Create two datetime arrays.

t1 = datetime('now')

%

t2 = datetime('tomorrow','Format','dd-MMM-yyyy HH:mm:ss') + caldays(0:2)

%
% Find the difference between the two arrays.

dt = between(t1,t2)

% between returns a calendarDuration array containing differences in terms of days, hours, minutes, and seconds.
% Copyright 2015 The MathWorks, Inc.