datetime

Methods

Method Reference: datetime.month

datetime: M = month (T)
datetime: M = month (T, monthType)

Month component of a datetime array.

M = month (T) returns the month number for each element of the input datetime array T. The output M is a double array containing integer values in the range [1, 12] and it has the same size as T. Not-A-Time (NaT) values in T are returned as NaN in the output array.

M = month (T, monthType) returns the month number or name for each element of the input datetime array T as specified by monthType, which may have any of the following options:

  • 'monthofyear' (default) returns the month number in a numeric array.
  • 'name' returns the corresponding full name of the month in a cell array of character vectors.
  • 'shortname' returns the corresponding 3-letter abbreviation of the month in a cell array of character vectors.

Source Code: datetime