I want to convert one time format into another type
7 ビュー (過去 30 日間)
古いコメントを表示
I have date and time data in this form '16-Aug-0022 04:39:55 PM' and I want to convert it in this form '08/16/2022 16:39:00'. Can you provide me with corresponding scripts
thank you in advance
1 件のコメント
dpb
2022 年 8 月 20 日
While @Star Strider provides a way to read these, I'd ask how got the malformed date string in the beginning and suggest fixing that issue.
回答 (2 件)
Star Strider
2022 年 8 月 20 日
Another approach —
dt1 = '16-Aug-0022 04:39:55 PM';
dt2 = datetime(dt1, 'InputFormat','dd-MMM-00yy hh:mm:ss a', 'Format','MM/dd/yyyy HH:mm:ss')
Note the specific 'InputFormat' string that accounts for the first two numbers of the year being '00'. No other conversion required!
.
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!