Convert data table to datetime
112 ビュー (過去 30 日間)
古いコメントを表示
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/608220/image.png)
I want to convert the second row into a datetime vector, but InputFormat doesn't work.
It's a number, e.g. 201401010000 meaning jan 1st 2014 00:00.
I tried datetime( BLA,'InputFormat','yyyyMMddHHmm')
0 件のコメント
採用された回答
Adam Danz
2021 年 5 月 5 日
編集済み: Adam Danz
2021 年 5 月 6 日
> It's a number, e.g. 201401010000 meaning jan 1st 2014 00:00.
x = 201401010000;
dt = datetime(string(x),'InputFormat','yyyyMMddHHmm')
The 'format' property specifies the output format.
x can be a column of values.
3 件のコメント
Adam Danz
2021 年 5 月 6 日
> I want to convert the second row into a datetime vector
> I would like to e.g. convert it to a timetable
Those are two very different questions.
I've updated my answer. After converting the column to datetime use
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!