Duration in years
Y = years(
returns
an array of years equivalent to the values in X
)X
.
If X
is a numeric array, then Y
is
a duration
array in units of fixed-length years.
A fixed-length year is equal to 365.2425 days.
If X
is a duration
array,
then Y
is a double
array with
each element equal to the number of fixed-length years in the corresponding
element of X
.
The years
function converts between duration
and double
values.
To display a duration in units of years, set its Format
property
to 'y'
.
Leap years have one extra day. To create an array of calendar years that
account for leap years when used in calendar calculations, use the
calyears
function.