Conversion of seconds to date
이전 댓글 표시
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
채택된 답변
추가 답변 (1개)
Valérie Le Guennec
2018년 4월 23일
0 개 추천
댓글 수: 1
Ozan Akyildiz
2019년 2월 11일
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.
카테고리
도움말 센터 및 File Exchange에서 Time Series Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!