Home > atmlab > time > days2hms.m

days2hms

PURPOSE ^

DAYS2HMS Convert days into hours, minutes, and seconds.

SYNOPSIS ^

function [hour, minute, second] = days2hms(days)

DESCRIPTION ^

DAYS2HMS Convert days into hours, minutes, and seconds.

   [HOUR, MINUTE, SECOND] = DAYS2HMS(DAYS) converts the number of days to
   hours, minutes, and seconds.

   The following holds (to within rounding precision):

     DAYS = HOUR / 24 + MINUTE / (24 * 60) + SECOND / (24 * 60 * 60)
          = (HOUR + (MINUTE + SECOND / 60) / 60) / 24

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

days2hms.m

SOURCE CODE ^

0001 function [hour, minute, second] = days2hms(days)
0002 %DAYS2HMS Convert days into hours, minutes, and seconds.
0003 %
0004 %   [HOUR, MINUTE, SECOND] = DAYS2HMS(DAYS) converts the number of days to
0005 %   hours, minutes, and seconds.
0006 %
0007 %   The following holds (to within rounding precision):
0008 %
0009 %     DAYS = HOUR / 24 + MINUTE / (24 * 60) + SECOND / (24 * 60 * 60)
0010 %          = (HOUR + (MINUTE + SECOND / 60) / 60) / 24
0011 
0012 %   Author:      Peter J. Acklam
0013 %   Time-stamp:  2002-03-03 12:52:02 +0100
0014 %   E-mail:      pjacklam@online.no
0015 %   URL:         http://home.online.no/~pjacklam
0016 
0017    error(nargchk(1, 1, nargin));
0018 
0019    second = 86400 * days;
0020    hour   = fix(second/3600);           % get number of hours
0021    second = second - 3600*hour;         % remove the hours
0022    minute = fix(second/60);             % get number of minutes
0023    second = second - 60*minute;         % remove the minutes

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