Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan 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 = 736939

Use the optional argument outputType to return a datetime array.

Date = today('datetime')
Date = datetime
   01-Sep-2017

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

Was this topic helpful?