y = year( returns the ISO year
numbers for the datetime values in
t. ISO year numbers
include a year zero and represent years BCE using negative values. The
y output is a
double array the same
Extract Year Number from Dates
Extract the year numbers from an array of dates.
t = datetime(2010,05,31):calyears(1):datetime(2015,02,28)
t = 1x5 datetime 31-May-2010 31-May-2011 31-May-2012 31-May-2013 31-May-2014
y = year(t)
y = 1×5 2010 2011 2012 2013 2014
yearType — Type of year values
'iso' (default) |
Type of year values, specified as either
yearreturns the ISO year number, which includes a year zero and represents years BCE using negative values.
yearreturns the Gregorian year number, which is an unsigned integer. For example, the Gregorian year number for 5 CE and 5 BCE is 5 in both cases. Gregorian year numbers do not have a year zero.
Calculate with arrays that have more rows than fit in memory.
This function fully supports tall arrays. For more information, see Tall Arrays.
Run code in the background using MATLAB®
backgroundPool or accelerate code with Parallel Computing Toolbox™
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).