How to reverse datenum?

24 ビュー (過去 30 日間)
Zoe
Zoe 2011 年 6 月 16 日
回答済み: Peter Perkins 2018 年 8 月 3 日
SOS: How to convert serial date number back to date, in the format of mm/dd/yyyy?
Thanks SO MUCH!!

採用された回答

Sean de Wolski
Sean de Wolski 2011 年 6 月 16 日
datevec or datestr
doc datevec
doc datestr
%For future reference: since you're using datenum, the conversions are probably related to it; if you look at the bottom of:
doc datenum
it has the inverses.
  1 件のコメント
Zoe
Zoe 2011 年 6 月 16 日
I ll be careful next time! Thanks a lot!~~

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

その他の回答 (2 件)

Walter Roberson
Walter Roberson 2011 年 6 月 16 日
datestr(serialnum, 'MM/DD/YYYY')
  2 件のコメント
Zoe
Zoe 2011 年 6 月 16 日
Thanks a lot :)
George Scott
George Scott 2018 年 7 月 17 日
'mm/dd/YYYY' ('MM' is a minutes format, not months)

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


Peter Perkins
Peter Perkins 2018 年 8 月 3 日
The longer answer is, Don't use datenum and datestr at all if you can avoid it. Use datetime, no conversion back and forth between number and text necessary.

カテゴリ

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