How to convert a string into a date or datenum?
조회 수: 7 (최근 30일)
이전 댓글 표시
I have a column, about [4000 x 1] with the format 'yyyymmddHH'. Yes, all the numbers are together.
And i need to get a date, or a datenum from that, but i cant, since functions like datetime need the numbers separated.
Anyone know how to get arround this?
Thank you.
댓글 수: 0
답변 (1개)
Stephen23
2021년 6월 17일
편집: Stephen23
2021년 6월 17일
"... but i cant, since functions like datetime need the numbers separated."
I don't see that restriction mentioned anywhere in the DATETIME documentation.
S = ["2021061701";"2021010100";"1913061423"]
D = datetime(S, 'InputFormat','yyyyMMddHH')
댓글 수: 6
Stephen23
2021년 6월 18일
@Bruno Carvalho: you can accept this answer, if one of the comments includes the solution.
참고 항목
카테고리
Help Center 및 File Exchange에서 Calendar에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!