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 CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by