Matlab - how to convert date format in example provided
조회 수: 2 (최근 30일)
이전 댓글 표시
In my code below I am unable to convert the date format in column 1 from dd/MM/yyyy to MM-dd-yyyy. How do I configure it correctly to stop seeing this error??
>> T = readtable("IGEv3.xlsx");
>> tday=T{2:end, 1};
>> tday=datestr(datenum(tday, 'dd-MM-yyyy'), 'MM-dd-yyyy')
Error using datetime/datenum
Too many input arguments.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/398029/image.png)
댓글 수: 0
채택된 답변
Ameer Hamza
2020년 10월 31일
편집: Ameer Hamza
2020년 10월 31일
You just need to change the format property of the datetime object
T = readtable("IGEv3.xlsx");
tday = T{2:end, 1};
tday.Format = 'MMM-dd-yyyy';
댓글 수: 2
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Financial Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!