Code covered by the BSD License  

Highlights from
Calculate Time Interval/ Difference

Calculate Time Interval/ Difference

by

 

01 Nov 2010 (Updated )

To compute time interval, taking into account leap days that are subsumed within that interval.

sec2hms(sec)
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;

Contact us