필터 지우기
필터 지우기

Reformatting Dates

조회 수: 3 (최근 30일)
Syed Abbas
Syed Abbas 2011년 12월 27일
Hi, I have dates in the format 12/01/2011. Is there a way to reformat these dates by removing the forward slashes? For example, I want 12/01/2011 to become 12012011. Thanks.

채택된 답변

Jan
Jan 2011년 12월 27일
strrep is faster than regexprep:
a = '12/01/2011';
% Or a cell string also:
% a = {'12/01/2011', '12/01/2012'};
b = strrep(a, '/', '');
  댓글 수: 1
Syed Abbas
Syed Abbas 2011년 12월 27일
thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Friedrich
Friedrich 2011년 12월 27일
Hi,
you can use regexprep for that:
>> a = '12/01/2011'
a =
12/01/2011
>> regexprep(a,'/','')
ans =
12012011
  댓글 수: 1
Syed Abbas
Syed Abbas 2011년 12월 27일
Thanks!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Seismology에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by