Conversion of seconds to date
Ältere Kommentare anzeigen
Hello,
I have a datasets with time expressed in seconds since 1950-01-01 00:00:00. The two times I would like to convert are : [1907798400] and [1908230400]. I would like to convert them in a date format (Yr-Mnth-Day Hr:min:sec) I previously look on the forum to help me and I did the following steps :
base = datenum(1950,1,1);
datestr([1907798400]/86400) + base)
>> '16-Jun-2010'
base = datenum(1950,1,1);
datestr([1908230400]/86400) + base)
>> '21-Jun-2010'
However, I expect to obtain dates in the months of July 2010. Also, when I open the datasets using Panoply, I obtain the following dates : 2010-07-01 00:00:00 - 2010-07-06 00:00:00. (Yr-Mnth-Day Time)
This is more likely to be what I expect. However, I don't understand why using Matlab I obtain different dates? The year is correct (2010), but not the month. Is there something I am doing wrong?
Could you help me solve this issue?
Thank you a lot for your help.
Regards
Akzeptierte Antwort
Weitere Antworten (1)
Valérie Le Guennec
am 23 Apr. 2018
0 Stimmen
1 Kommentar
Ozan Akyildiz
am 11 Feb. 2019
Why is this the accepted answer? This is not helping the reader. I suggest Posting the answer you found as an "Answer" then selecting it.
Kategorien
Mehr zu Dates and Time finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!