How do I convert a string to date time?

조회 수: 2 (최근 30일)
Yujeong Bae
Yujeong Bae 2020년 4월 24일
답변: per isakson 2020년 4월 24일
In one excel file, the date time is given ''Mon Apr 20 11:45:22 KST 2020''.
I used the function 'datetime'
txt = 'Mon Apr 20 11:45:22 KST 2020'
datetime(txt, 'InputFormat', 'eee-MMM-dd-hh:mm:ss-Z-yyyy')
I cannot find the way to convert 'KST', where KST means Korea standard time.
How can I convert this string as a date time?

답변 (1개)

per isakson
per isakson 2020년 4월 24일
I found this example in the documentation of datetime
Specify the current date and time in the time zone represented by Seoul, Korea
t = datetime('now','TimeZone','Asia/Seoul','Format','d-MMM-y HH:mm:ss Z')
t = datetime
29-Feb-2020 14:09:02 +0900

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by