Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

day

Syntax

Description

example

DayMonth = day(Date) returns the day of the month given a serial date number or date character vector.

example

DayMonth = day(Date,F) returns the day of the month, given a serial date number or character vector and an optional argument, F, defining the date format for Date.

Examples

collapse all

Find the day of the month using a serial date number.

DayMonth = day(730544)
DayMonth =

    28

Find the day of the month using a date character vector.

DayMonth = day('2/28/00')
DayMonth =

    28

Find the day of the month using a date character vector with an optional argument F for a country-specific date format.

DayMonth = day('28/02/00','dd/mm/yyyy')
DayMonth =

    28

Related Examples

Input Arguments

collapse all

Date to determine day of month, specified as a serial date number, date character vector, or cell array of date character vectors.

All the date character vectors in Date must have same date character vector format. For more information on supported date character vector formats, see datestr.

Example: DayMonth = day({'2/28/00','3/10/06'})

Data Types: single | double | char | cell

Country-specific date format, specified as a character vector to designate the date format for the input argument Date. For more information on supported date character vector format symbols, see datestr. Note, formats with 'Q' are not accepted.

Example: DayMonth = day('28/02/00','dd/mm/yyyy')

Data Types: char

Output Arguments

collapse all

Day of the month, returned as a nonnegative integer, given a serial date number or date character vector.

See Also

| | | |

Introduced before R2006a

Was this topic helpful?