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.

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by