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.

采纳的回答

Ameer Hamza
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';

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Financial Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by