Converting time variable in excel into datetime datatype

조회 수: 1 (최근 30일)
Sree Harsha Bandaru
Sree Harsha Bandaru 2020년 6월 23일
댓글: Star Strider 2020년 6월 24일
I imported time from excel file using readtable and it seems that the variable time is in text form. My time in excel has this format: 20190101:1700 How can i convert this in to datetime datatype in matlab

채택된 답변

Star Strider
Star Strider 2020년 6월 23일
Assuming the date format and that the rows are character arrays, try this:
dtc = '20190101:1700';
dt = datetime(dtc, 'InputFormat','yyyyMMdd:HHmm')
producing:
dt =
datetime
01-Jan-2019 17:00:00
.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

제품


릴리스

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by