Converting to different date format

1 Ansicht (letzte 30 Tage)
Aadil
Aadil am 4 Sep. 2012
Hi,
I would like to convert this date:
2012-09-01
to
2012-9-1
How can I do this?
Thanks,

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 4 Sep. 2012
try use
regexprep('2012-09-01','-0','-')
  3 Kommentare
Azzi Abdelmalek
Azzi Abdelmalek am 4 Sep. 2012
nice
Andrei Bobrov
Andrei Bobrov am 4 Sep. 2012
Thank you Azzi!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Azzi Abdelmalek
Azzi Abdelmalek am 4 Sep. 2012
d='2009-09-01'
c=regexp(d,'-','split')';
e=[c{1} '-' num2str(str2num(c{2})) '-' num2str(str2num(c{3}))]

Kategorien

Mehr zu Dates and Time finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by