Date formats 'uuuu' vs 'yyyy', 'mm' vs 'MM'
Show older comments
Hello,
Can anyone explain to me when to use "uuuu" for years, upper or lower case for m month?
'dd/mm/yyyy HH:MM'
or
'dd/MM/uuuu HH:mm'
for '14/03/2021 07:30' (14th of March 2021 at 7.30am)
Some functions seem to use one format and others the other one. Every time I try with one, it's the other one.
Is there a certain logic behind this?
1 Comment
"Is there a certain logic behind this?"
Yes.
The older functions DATENUM, DATESTR, and DATEVEC all use a very simple TMW-defined format where:
- time components are uppercase,
- date components are lowercase (apart from Q for year quarter).
Then for much newer DATETIME they changed to a different format which:
- also specifies timezones, and other useful date features,
- is consistent with the Unicode Locale Data Markup Language (LDML) international standard (but does not implement all of it).
Accepted Answer
More Answers (0)
Categories
Find more on Calendar in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!