Calculate Time Interval/ Difference
01 Nov 2010
15 Jan 2011)
To compute time interval, taking into account leap days that are subsumed within that interval.
function [hour, minute, second] = sec2hms(sec)
%SEC2HMS Convert seconds to hours, minutes and seconds.
% [HOUR, MINUTE, SECOND] = SEC2HMS(SEC) converts the number of seconds in
% SEC into hours, minutes and seconds.
hour = fix(sec/3600); % get number of hours
sec = sec - 3600*hour; % remove the hours
minute = fix(sec/60); % get number of minutes
sec = sec - 60*minute; % remove the minutes
second = sec;