Home > atmlab > time > dayofmonth.m

dayofmonth

PURPOSE ^

DAYOFMONTH Ordinal number of month in year.

SYNOPSIS ^

function md = dayofmonth(varargin)

DESCRIPTION ^

DAYOFMONTH Ordinal number of month in year.

   DAYOFMONTH(YEAR, MONTH, DAY, HOUR, MINUTE, SECOND) returns the ordinal
   day number in the given month plus a fractional part depending on the
   time of day.

   Any missing MONTH or DAY will be replaced by ones.  Any missing HOUR,
   MINUTE or SECOND will be replaced by zeros.

   If no date is specified, the current date and time is used.  Gregorian
   calendar is assumed.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

dayofmonth.m

SOURCE CODE ^

0001 function md = dayofmonth(varargin)
0002 %DAYOFMONTH Ordinal number of month in year.
0003 %
0004 %   DAYOFMONTH(YEAR, MONTH, DAY, HOUR, MINUTE, SECOND) returns the ordinal
0005 %   day number in the given month plus a fractional part depending on the
0006 %   time of day.
0007 %
0008 %   Any missing MONTH or DAY will be replaced by ones.  Any missing HOUR,
0009 %   MINUTE or SECOND will be replaced by zeros.
0010 %
0011 %   If no date is specified, the current date and time is used.  Gregorian
0012 %   calendar is assumed.
0013 
0014 %   Author:      Peter J. Acklam
0015 %   Time-stamp:  2002-03-03 12:52:09 +0100
0016 %   E-mail:      pjacklam@online.no
0017 %   URL:         http://home.online.no/~pjacklam
0018 
0019    nargsin = nargin;
0020    error(nargchk(0, 6, nargsin));
0021    if nargsin
0022       argv = {1 1 1 0 0 0};
0023       argv(1:nargsin) = varargin;
0024    else
0025       argv = num2cell(clock);
0026    end
0027    [year, month, day, hour, minute, second] = deal(argv{:});
0028 
0029    md = day + ( second + 60*minute + 3600*hour )/86400;

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