Borrar filtros
Borrar filtros

Matlab - how to convert date format in example provided

2 visualizaciones (últimos 30 días)
olayinka ola
olayinka ola el 31 de Oct. de 2020
Comentada: Ameer Hamza el 31 de Oct. de 2020
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.

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 31 de Oct. de 2020
Editada: Ameer Hamza el 31 de Oct. de 2020
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 comentarios
olayinka ola
olayinka ola el 31 de Oct. de 2020
Brilliant thanks, so simple!
Ameer Hamza
Ameer Hamza el 31 de Oct. de 2020
I am glad to be of help!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Financial Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by