today

Syntax

Date = today
Date = today(outputType)

Description

example

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

example

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

Examples

collapse all

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

Date = today
Date = 737527

Use the optional argument outputType to return a datetime array.

Date = today('datetime')
Date = datetime
   12-Apr-2019

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