Day number or name
d = day(t)
d = day(t,dayType)
Extract the day of month numbers from an array of dates.
t = [datetime('yesterday');datetime('today');datetime('tomorrow')]
t = 3×1 datetime array 23-Feb-2017 24-Feb-2017 25-Feb-2017
d = day(t)
d = 23 24 25
Determine the day of the week for an arbitrary date, by specifying
'name' as the second input to the
t = datetime(2014,05,16)
t = datetime 16-May-2014
d = day(t,'name')
d = cell 'Friday'
'dayofweek' to return the day of the week as a number.
d = day(t,'dayofweek')
d = 6
t— Input date and time
Input date and time, specified as a
dayType— Type of day values
Type of day values, specified as a value in the table.
|Value of ||Description|
|Day-of-month number, from 1 to 28, 29, 30, or 31. The range depends on the month.|
|Day-of-week number, from 1 to 7, where day 1 of the week is Sunday.|
|Day-of-year number, from 1 to 365 or 366, depending on the year.|
|Full day names, for example, |
|Abbreviated day names, for example, |
d— Day number or name
doublearray | cell array of character vectors
Day number or name, returned as a numeric array of integers
double, or a cell array of character vectors.
the same size as
This function fully supports tall arrays. For more information, see Tall Arrays.