m = month(t,monthType)
returns the type of month number or name specified by
monthType.
The month function returns the month numbers or names of
datetime values. To assign month numbers to datetime array t,
use t.Month and modify the Month property.
Input date and time, specified as a datetime array.
monthType — Type of month values 'monthofyear' (default) | 'name' | 'shortname'
Type of month values, specified as a value in the table.
Value of
monthType
Description
'monthofyear'
Month-of-year number
'name'
Full month names, for example,
August or
September. For
NaT datetime values, the month
name is the empty character vector,
''.
'shortname'
Abbreviated month names, for example,
Aug or Sep.
For NaT datetime values, the month
name is the empty character vector,
''.
Note
month returns month names in the language specified
by the Locale option in the Datetime format section of the Preferences
panel. To change the default datetime locale, see Set Command Window Preferences.