convert exp number to datetime

8 views (last 30 days)
Sim
Sim on 18 Oct 2022
Commented: Sim on 18 Oct 2022
Hi, I have this number that I would like to convert into datetime.. I am not sure about which function to use and how.. any suggestion ?
% input
2.022051711034598e+16
% desired output
'2022-05-17 11:03:45.980'
  1 Comment
Sim
Sim on 18 Oct 2022
this obviously does not work..
datetime(2.022051711034598e+16,'format','dd-mmm-yyyy HH:MM:SS')

Sign in to comment.

Accepted Answer

Stephen23
Stephen23 on 18 Oct 2022
N = 2.022051711034598e+16;
S = string(uint64(N))
S = "20220517110345980"
D = datetime(S, 'inputFormat','uuuuMMddHHmmssSSS', 'Format','yyyy-MM-dd HH:mm:ss.SSS')
D = datetime
2022-05-17 11:03:45.980

More Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!