Main Content




Date = today returns the current date as a serial date number.


Date = today(outputType) returns the current date using an optional outputType. The type of output is determined by an optional outputType variable input.


collapse all

Use today to return the current date with the default serial date number.

Date = today
Date = 738400

Use the optional argument outputType to return a datetime array.

Date = today('datetime')
Date = datetime

Input Arguments

collapse all

Type of output, specified as a character vector with values 'datetime' or 'datenum'.

If outputType is 'datenum', then Date is a serial date number. If outputType is 'datetime', then Date is a datetime array. By default, outputType is 'datenum'.

Data Types: char

Output Arguments

collapse all

Current date, returned as a serial date number or datetime array, depending on the optional input argument outputType.

Introduced before R2006a