datetime to string conversion
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
alpedhuez
el 12 de Mzo. de 2022
Comentada: Star Strider
el 12 de Mzo. de 2022
I have
day = datetime(2008,04,01)
with the output
day =
datetime
01-Apr-2008
I then run
string(day)
with the output
ans =
"01-Apr-2008"
But I want to have a string "20080401." Is there any simple way to do this?
0 comentarios
Respuesta aceptada
Star Strider
el 12 de Mzo. de 2022
Ise the 'Format' name-value pair —
dayv = datetime(2008,04,01, 'Format','yyyyMMdd')
string(dayv)
.
2 comentarios
Star Strider
el 12 de Mzo. de 2022
Again, use 'Format' —
datelimits = datetime({'20080401', '20080402'}, 'InputFormat', 'yyyyMMdd', 'Format','yyyyMMdd')
.
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Type Conversion en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!