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.


Current date as character vector


c = date



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.


collapse all

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

c = date
c = 


  • 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.


  • As an alternative, use the datetime function to represent the current date.

    d = datetime('today')

    The datetime function takes your locale into account. Also, you can specify the format that a datetime array uses to represent its values.

Introduced before R2006a