Borrar filtros
Borrar filtros

Convert datetime to string

214 visualizaciones (últimos 30 días)
Ali razi
Ali razi el 12 de Oct. de 2022
Respondida: Adam Danz el 12 de Oct. de 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

Respuesta aceptada

Adam Danz
Adam Danz el 12 de Oct. de 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"

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by