datetime

Methods

Method Reference: datetime.day

datetime: D = day (T)
datetime: D = day (T, dayType)

Day component of a datetime array.

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

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

  • 'dayofmonth' (default) returns the day-of-month number in a numeric array. Depending on the month and year, it can range from 1 to 28, 29, 30, or 31.
  • 'dayofweek' returns the day-of-week number in a numeric array of double integer values ranging from 1 to 7, where 1 corresponds to Sunday.
  • 'iso-dayofweek' returns the day-of-week number in a numeric array of double integer values ranging from 1 to 7, where 1 corresponds to Monday according to the ISO 8601 standard.
  • 'dayofyear' returns the day-of-year number in a numeric array of double integer values ranging from 1 to 365 or 366, depending on the year.
  • 'name' returns the corresponding full name of the day in a cell array of character vectors.
  • 'shortname' returns the corresponding 3-letter abbreviation of the day in a cell array of character vectors.

Source Code: datetime