How to extract year and month from attached string.

8 visualizaciones (últimos 30 días)
varunesh
varunesh el 10 de En. de 2019
Comentada: madhan ravi el 10 de En. de 2019
I want to extract year and month from attached string data. Please help me.
Thank you so much in advance.
Regard's
Varunesh

Respuesta aceptada

madhan ravi
madhan ravi el 10 de En. de 2019
Editada: madhan ravi el 10 de En. de 2019
load('date.mat');
a=date{:,:};
b=regexp(a,'\T','split');
b=[b{:}];
B=datetime(b(1:2:end).','InputFormat','yyyy-MM-dd');
[year,month,day]=ymd(B);
  3 comentarios
varunesh
varunesh el 10 de En. de 2019
Thank you so much. It is working.
Can you help me with another question? Please look once, If possible then please help me. a link is below.
madhan ravi
madhan ravi el 10 de En. de 2019
Anytime :) , not sure if I can help with that though sorry.

Iniciar sesión para comentar.

Más respuestas (1)

Walter Roberson
Walter Roberson el 10 de En. de 2019
times = datetime(date.datetime, 'InputFormat', 'yyyy-MM-dd''T''HH:mm:ss');
By the way, your times are not completely sorted.

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by