フィルターのクリア

Question on datetime Input Format

6 ビュー (過去 30 日間)
Xymbu
Xymbu 2021 年 1 月 30 日
回答済み: Cris LaPierre 2021 年 1 月 30 日
I can't seem to get the input format for the date time conversion that works with data formatted as shown below
'Sat Jan 30 03:05:15 +0000 2021'
ive tried
'eeee MMMM d HH:mm:ss Z y'
but still nothing

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 1 月 30 日
The trick for me was having to specify a time zone. I'm not sure what timezone it should be so I selected UTC. I found the format section of the datetime documentation page helpful in getting the input format correct.
d='Sat Jan 30 03:05:15 +0000 2021';
D = datetime(d,"InputFormat","eee MMM dd HH:mm:ss Z yyyy","TimeZone","UTC")
D = datetime
30-Jan-2021 03:05:15

その他の回答 (0 件)

カテゴリ

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