(Not recommended; use
datetime("today")) Current date as
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.
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.
Return Current Date
To return the current date as a character vector, use the
c = date
c = '19-Aug-2023'
datealways 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.
Run code in the background using MATLAB®
backgroundPool or accelerate code with Parallel Computing Toolbox™
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Version HistoryIntroduced before R2006a
R2022b: Not recommended
There are no plans to remove
date. However, the
datetime function is recommended instead. The
type provides flexible date and time formats, storage out to nanosecond precision, and
properties to account for time zones and daylight saving time. It also takes your locale
To return the current date as a
datetime value, call
"today" as the input
d = datetime("today")
d = datetime
To return the current date as text, convert the
datetime value to a
d = datetime("today");
d = string(d)
d = "15-Apr-2022"