datenum input string format
Ältere Kommentare anzeigen
I have dates created by another software which have a different formats than recognized by MATLAB. These days are like this:
'2012-06-01T03:15:00Z'
I want to feed these dates to datenum() and extract the date and time, but datenum doesn't support this format. Is there any way to define a custom time format in matlab? or any other suggestion please
Bests
2 Kommentare
Azzi Abdelmalek
am 18 Jul. 2013
Are T and Z always in this format?
hasan
am 18 Jul. 2013
Akzeptierte Antwort
Weitere Antworten (3)
Azzi Abdelmalek
am 18 Jul. 2013
Bearbeitet: Azzi Abdelmalek
am 18 Jul. 2013
d='2012-06-01T03:15:00Z'
a=regexp(d,'[^T Z]+','match')
b=datestr(datenum(horzcat(a{:}),'yyyy-mm-ddHH:MM:SS'))
% or
d='2012-06-01T03:15:00Z'
a=regexprep(d,'[T Z]+',' ')
Azzi Abdelmalek
am 18 Jul. 2013
d='2012-06-01T03:15:00Z'
out=datestr(datenum(d,'YYYY-mm-ddTHH:MM:SS'),'YYYY-mm-dd HH:MM:SS')
Andrei Bobrov
am 18 Jul. 2013
q = '2012-06-01T03:15:00Z'
out = datenum(str2double(regexp(q,'\d*','match')));
Kategorien
Mehr zu Dates and Time finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!