datetime format issue?

조회 수: 1 (최근 30일)
alpedhuez
alpedhuez 2022년 3월 12일
댓글: alpedhuez 2022년 3월 12일
As a continuation of a previous question,
datelimits = datetime({'20080401', '20080402'}, 'InputFormat', 'yyyyMMdd');
outputs
datelimits =
1x2 datetime array
01-Apr-2008 02-Apr-2008
Although it should output
20080401 20080402
Please advise how to fix this issue so that it would output in the correct format.

채택된 답변

Cris LaPierre
Cris LaPierre 2022년 3월 12일
편집: Cris LaPierre 2022년 3월 12일
You have only set the input format, which is used to read in the data, so it is using the default format to display the date. The display format is set using the 'Format' option.
datelimits = datetime({'20080401', '20080402'}, 'InputFormat', 'yyyyMMdd','Format','yyyyMMdd')
datelimits = 1×2 datetime array
20080401 20080402

추가 답변 (1개)

Arif Hoq
Arif Hoq 2022년 3월 12일
datelimits = datetime({'20080401', '20080402'}, 'Format', 'yyyyMMdd')
datelimits = 1×2 datetime array
20080401 20080402
  댓글 수: 1
alpedhuez
alpedhuez 2022년 3월 12일
Thnak you.

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

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by