%% Compute Elapsed Time
% Compute the time elapsed between a specific time and the current time, to 0.01-second accuracy.
% Define the initial date and time and convert to date vector form.

format shortg
str = 'March 28, 2012 11:51:00';
t1 = datevec(str,'mmmm dd, yyyy HH:MM:SS')

%
% Determine the current date and time.

t2 = clock

% The clock function returns the current date and time as a date vector.
%
% Use etime to compute the number of seconds between t1 and t2.

e = etime(t2,t1)

% Copyright 2015 The MathWorks, Inc.