datetime to string conversion
조회 수: 2 (최근 30일)
이전 댓글 표시
I have
day = datetime(2008,04,01)
with the output
day =
datetime
01-Apr-2008
I then run
string(day)
with the output
ans =
"01-Apr-2008"
But I want to have a string "20080401." Is there any simple way to do this?
댓글 수: 0
채택된 답변
Star Strider
2022년 3월 12일
Ise the 'Format' name-value pair —
dayv = datetime(2008,04,01, 'Format','yyyyMMdd')
string(dayv)
.
댓글 수: 2
Star Strider
2022년 3월 12일
Again, use 'Format' —
datelimits = datetime({'20080401', '20080402'}, 'InputFormat', 'yyyyMMdd', 'Format','yyyyMMdd')
.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 String Parsing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!