I am not getting the correct answer when using datetime function
Show older comments
Hi everyone,
I am using the following function
datetime(1,43100,1)
but instead of getting '31/12/2017' as an answer (as given from Excel), I am getting 01-Aug-3592. Apparently, I am missing something in the datetime function but don't know what it is.
Thanks in advance for your time.
Accepted Answer
More Answers (1)
Ted Shultz
on 17 Sep 2019
Edited: Ted Shultz
on 17 Sep 2019
You are using
t = datetime(Y,M,D)
Year = 1
month = 43100
day = 1
That is not what you intend I assume.
I think you want:
t = datetime(43100,'ConvertFrom','excel')
Categories
Find more on Calendar 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!