Convert data table to datetime
조회 수: 107 (최근 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!