Azzera filtri
Azzera filtri

Convert datetime to string

214 visualizzazioni (ultimi 30 giorni)
Ali razi
Ali razi il 12 Ott 2022
Risposto: Adam Danz il 12 Ott 2022
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

Risposta accettata

Adam Danz
Adam Danz il 12 Ott 2022
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"

Più risposte (0)

Categorie

Scopri di più su Data Type Conversion in Help Center e File Exchange

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by