I have a column of dates that are number (double format) such as 19940127 how can i convert it to matlab numeric date that corresponds to 1994/01/27?

 채택된 답변

Star Strider
Star Strider 2016년 10월 1일
편집: Star Strider 2016년 10월 1일

1 개 추천

One approach:
dd = 19940127;
out = datestr(datenum(num2str(dd, '%d'), 'yyyymmdd'), 'yyyy/mm/dd')
out =
1994/01/27
To get the date number, just use part of that:
out_dn = datenum(num2str(dd, '%d'), 'yyyymmdd')
EDIT Added ‘out_dn’.

추가 답변 (1개)

Steven Lord
Steven Lord 2016년 10월 1일

0 개 추천

Use the datetime function with the 'ConvertFrom', 'yyyymmdd' option.

카테고리

도움말 센터File Exchange에서 Dates and Time에 대해 자세히 알아보기

태그

질문:

2016년 10월 1일

답변:

2016년 10월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by