Home > atmlab > time > sec2hms.m

sec2hms

PURPOSE ^

SEC2HMS Convert seconds to hours, minutes and seconds.

SYNOPSIS ^

function [hour, minute, second] = sec2hms(sec)

DESCRIPTION ^

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.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

sec2hms.m

SOURCE CODE ^

0001 function [hour, minute, second] = sec2hms(sec)
0002 %SEC2HMS  Convert seconds to hours, minutes and seconds.
0003 %
0004 %   [HOUR, MINUTE, SECOND] = SEC2HMS(SEC) converts the number of seconds in
0005 %   SEC into hours, minutes and seconds.
0006 
0007 %   Author:      Peter J. Acklam
0008 %   Time-stamp:  2002-03-03 12:50:09 +0100
0009 %   E-mail:      pjacklam@online.no
0010 %   URL:         http://home.online.no/~pjacklam
0011 
0012    hour   = fix(sec/3600);      % get number of hours
0013    sec    = sec - 3600*hour;    % remove the hours
0014    minute = fix(sec/60);        % get number of minutes
0015    sec    = sec - 60*minute;    % remove the minutes
0016    second = sec;

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005