etdays#

Purpose#

Computes the difference between two times, as generated by the date() command, in days.

Format#

days = etdays(t_start, t_end)#
Parameters:
  • t_start (3x1 or 4x1 vector) – starting date, in the order: yr, mo, day. (Only the first 3 elements are used.)

  • t_end (3x1 or 4x1 vector) – ending date, in the order: yr, mo, day. (Only the first 3 elements are used.) MUST be later than tstart.

Returns:

days (scalar) – elapsed time measured in days.

Examples#

// Set start date
t_start = { 2008, 1, 2 };

// Set ending date
t_end = { 2009, 9, 14 };

// Calculate elapsed number of days
d = etdays(t_start, t_end);

After the code above, d is equal to:

621

Remarks#

This will work correctly across leap years and centuries. The assumptions are a Gregorian calendar with leap years on the years evenly divisible by 4 and not evenly divisible by 100, unless divisible by 400.

Source#

time.src

See also

Functions dayinyr()