Converting to different date format

1 回表示 (過去 30 日間)
Aadil
Aadil 2012 年 9 月 4 日
Hi,
I would like to convert this date:
2012-09-01
to
2012-9-1
How can I do this?
Thanks,

採用された回答

Andrei Bobrov
Andrei Bobrov 2012 年 9 月 4 日
try use
regexprep('2012-09-01','-0','-')
  3 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 9 月 4 日
nice
Andrei Bobrov
Andrei Bobrov 2012 年 9 月 4 日
Thank you Azzi!

サインインしてコメントする。

その他の回答 (1 件)

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

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by