Categories &

Functions List

Function Reference: calyears

datatypes: calD = calyears (X)

Calendar duration in years.

calD = calyears (X) returns a calendarDuration array representing calendar years equivalent to the values in X, which must be a numeric array of integer values.

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

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

Source Code: calyears

Example: 1

calyears builds a calendar duration of whole years. Add the component builders together to assemble a full span.

 calyears (2)
ans =
  calendarDuration

   2y
 calyears (1) + calmonths (6) + caldays (15)
ans =
  calendarDuration

   1y 6mo 15d