Current date as character vector
c = date returns the current date as a character vector in the
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.
To return the current date as a character vector, use the
c = date
c = '26-Aug-2019'
date always returns the English abbreviation for the month name.
The function does not take your system locale into account when determining the month
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
d = datetime('today')
datetime function takes your locale into account. Also, you
can specify the format that a
datetime array uses to represent its