How to reverse datenum?

SOS: How to convert serial date number back to date, in the format of mm/dd/yyyy?
Thanks SO MUCH!!

 Accepted Answer

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 Comment

Zoe
Zoe on 16 Jun 2011
I ll be careful next time! Thanks a lot!~~

Sign in to comment.

More Answers (2)

datestr(serialnum, 'MM/DD/YYYY')

2 Comments

Zoe
Zoe on 16 Jun 2011
Thanks a lot :)
'mm/dd/YYYY' ('MM' is a minutes format, not months)

Sign in to comment.

Peter Perkins
Peter Perkins on 3 Aug 2018

0 votes

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.

Categories

Products

Asked:

Zoe
on 16 Jun 2011

Answered:

on 3 Aug 2018

Community Treasure Hunt

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

Start Hunting!