Method Reference: calendarDuration.calyears

calendarDuration: X = calyears (calD)

Calendar duration in years.

X = calyears (calD) returns a numeric array with the number of years as represented in calD.

calyears is also available as a function, in which case it performs the opposite conversion.

See also: calendarDuration.calquarters, calendarDuration.calmonths, calendarDuration.calweeks, calendarDuration.caldays, calyears

Source Code: calendarDuration

Example: 1

As a calendarDuration method, calyears returns the number of whole years in the span (the inverse of the calyears builder).

 d = calendarDuration (2, 3, 40)
d =
  calendarDuration

   2y 3mo 40d
 calyears (d)
ans = 2