Categories &

Functions List

Function Reference: years

datatypes: D = years (X)

Fixed-time duration in years.

D = years (X) returns a duration array representing fixed-time duration years equivalent to the values in X, which must be a numeric array. A fixed-length year is equal to 365.2425 days.

years is also available as a method for duration arrays, in which case it performs the opposite conversion.

See also: duration, days, hours, minutes, seconds, milliseconds, duration.years

Source Code: years

Example: 1

years builds a fixed-length year of 365.2425 days — a constant span, not a calendar year.

 years (1)
ans =
  duration

   1 yr
 years (0.5)
ans =
  duration

   0.5 yrs