I have a column of dates that are number (double format) such as 19940127 how can i convert it to matlab numeric date that corresponds to 1994/01/27?

 採用された回答

Star Strider
Star Strider 2016 年 10 月 1 日
編集済み: Star Strider 2016 年 10 月 1 日

1 投票

One approach:
dd = 19940127;
out = datestr(datenum(num2str(dd, '%d'), 'yyyymmdd'), 'yyyy/mm/dd')
out =
1994/01/27
To get the date number, just use part of that:
out_dn = datenum(num2str(dd, '%d'), 'yyyymmdd')
EDIT Added ‘out_dn’.

その他の回答 (1 件)

Steven Lord
Steven Lord 2016 年 10 月 1 日

0 投票

Use the datetime function with the 'ConvertFrom', 'yyyymmdd' option.

カテゴリ

ヘルプ センター および File ExchangeDates and Time についてさらに検索

タグ

質問済み:

2016 年 10 月 1 日

回答済み:

2016 年 10 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by