Converting time variable in excel into datetime datatype

I imported time from excel file using readtable and it seems that the variable time is in text form. My time in excel has this format: 20190101:1700 How can i convert this in to datetime datatype in matlab

 Respuesta aceptada

Assuming the date format and that the rows are character arrays, try this:
dtc = '20190101:1700';
dt = datetime(dtc, 'InputFormat','yyyyMMdd:HHmm')
producing:
dt =
datetime
01-Jan-2019 17:00:00
.

2 comentarios

Thank you very much. It worked
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Productos

Versión

R2019a

Etiquetas

Preguntada:

el 23 de Jun. de 2020

Comentada:

el 24 de Jun. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by