datetime default stetings 12/24
69 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lieke Numan
am 9 Aug. 2019
Verschoben: Dyuman Joshi
am 19 Dez. 2023
I used datetime.setDefaultFormats('default','hh:mm:ss yyyy-MM-dd') to set my default setting for datetime. However, time is running up to 12 instead of 24 hours. How can I change this?
0 Kommentare
Akzeptierte Antwort
Are Mjaavatten
am 10 Aug. 2019
Use HH instead of hh for the hours:
>> datetime.setDefaultFormats('default','hh:mm:ss yyyy-MM-dd')
>> t = datetime(2019,8,10,17,30,0)
t =
05:30:00 2019-08-10
>> datetime.setDefaultFormats('default','HH:mm:ss yyyy-MM-dd')
>> t
t =
17:30:00 2019-08-10
2 Kommentare
Guillaume
am 10 Aug. 2019
h Hour, 12-hour clock notation using one or two digits
hh Hour, 12-hour clock notation using two digits
H Hour, 24-hour clock notation using one or two digits
HH Hour, 24-hour clock notation using two digits
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Dates and Time finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!