Convert datetime to default format
조회 수: 3 (최근 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!