calyears
Calendar duration in years
Syntax
Description
The calyears
function returns an array that represents
calendar years. When you use arrays that have the calendarDuration
data type in calendar calculations, the calculations take into account leap years,
Daylight Saving Time shifts, and the differing lengths of calendar months. To create
exact fixed-length years instead, use the years
function. A fixed-length year is 365.2425 days
long.
returns an
array representing calendar years equivalent to the values in
Y
= calyears(X
)X
.
If
X
is a numeric array, thenY
is acalendarDuration
array with each element equal to the number of calendar years in the corresponding element ofX
.If
X
is acalendarDuration
array, thencalyears
returns the number of whole years equivalent to each calendar duration inX
.
Examples
Input Arguments
Output Arguments
Tips
calyears
creates years that account for leap days when used in calendar calculations. To create exact fixed-length (365.2425 day) years, use theyears
function.
Extended Capabilities
Version History
Introduced in R2014b