How to convert date to day number?
5 次查看(过去 30 天)
显示 更早的评论
Hello I wanna convert a date to day number. For example: 2012-Junuary-12 is equal to 12 days (we are talking about 12 days passed of 365 day) I don´t refer to Julian Day.
3 个评论
James Tursa
2017-7-28
编辑:per isakson
2017-7-28
@Jan: Julian Date and Day Of Year are two different things. Julian Date has a very specific meaning. E.g. from the USNO:
Or if you prefer Wiki
Jan
2017-8-1
Thanks, James. I hoped that the OP explain maore details also, e.g. how the input is represented and why he mentions the Julian Day.
回答(1 个)
Steven Lord
2017-7-28
dt = datetime('2012-January-12')
day(dt, 'dayofyear')
2 个评论
Peter Perkins
2017-8-1
And also:
>> dt = datetime(2012,1:3,12)
dt =
1×3 datetime array
12-Jan-2012 12-Feb-2012 12-Mar-2012
>> dt.Format = 'yyyy:D'
dt =
1×3 datetime array
2012:12 2012:43 2012:72
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!