Main Content

date

(Not recommended; use datetime("today")) Current date as character vector

date is not recommended. To return the current date as a datetime value, use datetime("today") instead. For more information on updating your code, see Version History or Replace Discouraged Instances of Serial Date Numbers and Date Strings.

Syntax

Description

example

c = date returns the current date as a character vector in the format dd-MMM-yyyy.

This format represents the day of the month (dd) as a number, the month name (MMM) as its three-letter abbreviation, and the year (yyyy) as a number.

Examples

collapse all

To return the current date as a character vector, use the date function.

c = date
c = 
'19-Aug-2023'

Limitations

  • date always returns the English abbreviation for the month name. The function does not take your system locale into account when determining the month name.

  • MATLAB® Online™ determines the current date from Coordinated Universal Time (UTC) rather than from local time.

Extended Capabilities

Version History

Introduced before R2006a

expand all