Code covered by the BSD License  

Highlights from
Calculate Time Interval/ Difference

Calculate Time Interval/ Difference


Michael Chan (view profile)


01 Nov 2010 (Updated )

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

function diy = daysinyear(year)
%DAYSINYEAR Number of days in a year.
%   DAYSINYEAR(YEAR) returns the number of days in the given year.
%   If no year is specified, the current year is used.  Gregorian calendar is assumed.

   if nargin < 1
      clk = clock;
      year = clk(1);

   diy = 365 + isleapyear(year);

Contact us