convert excel date to datetime
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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');
0 comentarios
Respuesta aceptada
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
Más respuestas (0)
Ver también
Categorías
Más información sobre Dates and Time en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!