MATLAB Answers

Convert date timestamp into Datenum

14 views (last 30 days)
Matlab
Matlab on 13 Aug 2019
Edited: Matlab on 28 Jan 2020
I want to convert date timestamp into one number

  0 Comments

Sign in to comment.

Accepted Answer

Guillaume
Guillaume on 13 Aug 2019
a) You shouldn't be using datenum. They're completely obsolete and everything you could do with them, you can do with datetime, and more.
b) The way a number is stored and the way a number is displayed are two completely different things. You can change the way matlab displays numbers at the command window wth the format command. Note that this will in no way affect the actual number, nor will it affects the way it is exported in a text or excel file. Again, this only affects the display in the command window
>> dn = now;
>> format short %change the format. DOES NOT CHANGE what's into dn
>> dn
dn =
7.3765e+05
>> format long
>> dn
dn =
7.376506267945486e+05
>> format longg %You probably want this format
>> dn
dn =
737650.626794549

  4 Comments

Show 1 older comment
Guillaume
Guillaume on 13 Aug 2019
The implentation of what?
Guillaume
Guillaume on 13 Aug 2019
I can't see any equation and I've really no idea what you're asking now.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!