How to reverse datenum?

21 visualizzazioni (ultimi 30 giorni)
Zoe
Zoe il 16 Giu 2011
Risposto: Peter Perkins il 3 Ago 2018
SOS: How to convert serial date number back to date, in the format of mm/dd/yyyy?
Thanks SO MUCH!!

Risposta accettata

Sean de Wolski
Sean de Wolski il 16 Giu 2011
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 Commento
Zoe
Zoe il 16 Giu 2011
I ll be careful next time! Thanks a lot!~~

Accedi per commentare.

Più risposte (2)

Walter Roberson
Walter Roberson il 16 Giu 2011
datestr(serialnum, 'MM/DD/YYYY')
  2 Commenti
Zoe
Zoe il 16 Giu 2011
Thanks a lot :)
George Scott
George Scott il 17 Lug 2018
'mm/dd/YYYY' ('MM' is a minutes format, not months)

Accedi per commentare.


Peter Perkins
Peter Perkins il 3 Ago 2018
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.

Categorie

Scopri di più su Dates and Time in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by