How to reverse datenum?

26 次查看(过去 30 天)
Zoe
Zoe 2011-6-16
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.

更多回答(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 CenterFile Exchange 中查找有关 Dates and Time 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by