How can I convert
datetime('now','TimeZone','local','Format','d-MMM-y HH:mm:ss')
to a string with this structure: 12-Oct-2022_18:12:17

 Akzeptierte Antwort

Adam Danz
Adam Danz am 12 Okt. 2022

3 Stimmen

Use string after formatting your datetime.
dt = datetime('now','TimeZone','local','Format','d-MMM-y HH:mm:ss')
dt = datetime
12-Oct-2022 18:30:14
dtstr = string(dt)
dtstr = "12-Oct-2022 18:30:14"

Weitere Antworten (0)

Kategorien

Produkte

Version

R2022b

Gefragt:

am 12 Okt. 2022

Beantwortet:

am 12 Okt. 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by