Borrar filtros
Borrar filtros

convert excel date to datetime

4 visualizaciones (últimos 30 días)
hafiz hashim
hafiz hashim el 25 de Oct. de 2019
Comentada: Star Strider el 25 de Oct. de 2019
how can i covert '20-Nov-18 12:00:00 PM GMT' by using datetime. i try by using fillowing command but it didnt work. can anyone please help me out
d = datetime(S.textdata, 'InputFormat', 'dd-MM-yy HH:mm, 'TimeZone', 'UTC');
thanks
d = datetime(S.textdata, 'InputFormat', 'dd-MM-yy HH:mm, 'TimeZone', 'UTC');

Respuesta aceptada

Star Strider
Star Strider el 25 de Oct. de 2019
The format has to match exactly.
Both of these work:
S.textdata = '20-Nov-18 12:00:00 PM GMT';
d1 = datetime(S.textdata(1:end-4), 'InputFormat', 'dd-MM-yy hh:mm:ss a', 'TimeZone', 'UTC')
d2 = datetime(S.textdata, 'InputFormat', 'dd-MM-yy hh:mm:ss a ''GMT''', 'TimeZone', 'UTC')
producing:
d1 =
datetime
20-Nov-2018 12:00:00
d2 =
datetime
20-Nov-2018 12:00:00
Experiment to get the result you want.
  2 comentarios
hafiz hashim
hafiz hashim el 25 de Oct. de 2019
Thank you so much for your help
Star Strider
Star Strider el 25 de Oct. de 2019
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by