Home > robbins > cal2dec.m

cal2dec

PURPOSE ^

CAL2DEC converts calander day to decimal day

SYNOPSIS ^

function t= cal2dec(month, day, hour, minute)

DESCRIPTION ^

 CAL2DEC converts calander day to decimal day

  Usage:  t= cal2dec(month, day, hour,minute)


 P. Robbins 94

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function t= cal2dec(month, day, hour, minute)
0002 % CAL2DEC converts calander day to decimal day
0003 %
0004 %  Usage:  t= cal2dec(month, day, hour,minute)
0005 %
0006 %
0007 % P. Robbins 94
0008 if nargin <3
0009   hour = 0;
0010 end
0011 if nargin < 4
0012   minute = 0;
0013 end
0014 
0015 months = [0 31 28 31 30 31 30 31 31 30 31 30 31];
0016 cummon = cumsum(months);
0017 
0018 if month > 12
0019 %  disp(['bogus month: ',num2str(month)])
0020   month = 1;
0021 end
0022 
0023 if day > 31
0024 %  disp(['bogus day: ',num2str(day)])
0025   day = 1;
0026 end
0027 
0028 
0029 t = cummon(month)' + day + hour/24 + minute/24/60;

Generated on Wed 30-Nov-2005 15:40:09 by m2html © 2003