This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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 = 737299

Use the optional argument outputType to return a datetime array.

Date = today('datetime')
Date = datetime
   27-Aug-2018

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