Conversion of Gregorian date to decimal years
17 次查看(过去 30 天)
显示 更早的评论
Hi,
I have time series given in gregorian time in seconds since 1992-01-01 00:00:00'. For example; 23853938,23853939...
How can i convert this gregorian time seconds to decimal years like 2010.544, 2010.545...
0 个评论
采纳的回答
Walter Roberson
2021-5-10
basetime = datetime('1992-01-01 00:00');
gtime = 23853938
t1 = basetime + seconds(gtime)
t2 = dateshift(t1, 'start', 'year')
t3 = dateshift(t1, 'end', 'year')
fy = year(t1) + (t1-t2)./(t3-t2)
3 个评论
Walter Roberson
2021-5-10
decyear() appears to require the Areospace Toolbox.
Also, setting the Format is not required for decyear()
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time Series Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!