Convert datetime to default format
4 次查看(过去 30 天)
显示 更早的评论
My input date time is 16:30:00 13-05-21. It's in HH:MM:SS dd-mm-yy format. I need to convert it into default format like this (13-May-2021 16:30:00).
I tried this but, the output comes out as NaT .
inp_time='16:30:00 13-05-21';
>> dtime=datetime(inp_time,'InputFormat','HH:MM:SS dd-mm-yy')
dtime= NaT
Can you help me here?
0 个评论
回答(2 个)
Steven Lord
2021-6-7
inp_time='16:30:00 13-05-21';
dtime=datetime(inp_time,'InputFormat','HH:MM:SS dd-mm-yy')
Have you tried swapping the M and m parts of the InputFormat as suggested by the warning messages?
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!