yyyymmdd
Converts dates to numbers of the form YYYYMMDD.
Category: Language Fundamentals > Data Types
Syntax
n = yyyymmdd(t)
Returns the date of each element of t as the number year*10000 + month*100 + day.
Description
The numbers sort in the same order as the dates, which makes them handy as compact keys for grouping or file names. The time of day is dropped.
Input arguments
t- A
datetimearray.
Output arguments
n- Double array, same size as
t. For 15 March 2024 the value is20240315.
Example
yyyymmdd(datetime(2024, 3, 15) + days(0:1))
Output
ans = 1×2
20240315 20240316