date
Today's date as text.
Category: Language Fundamentals > Data Types
Syntax
d = date
Returns the current date in the form dd-mmm-yyyy.
Description
date is shorthand for datestr(now, 1). The result is text, so it cannot be used directly for date arithmetic; use datetime('today') for that. The value changes each day, so examples should not print it.
Output arguments
d- Char vector of length 11, such as
'06-Nov-2026'.
Example
Format of the result
d = date;
class(d)
length(d)
Output
ans = 'char'
ans = 11