Converting fractional doy (eg. 208.572917) to a date with mm/dd/yyyy HH:MM
Show older comments
I have a set of data that includes doy for the year, 2013, but the doy are fractions such that July 27th at 13:45 would be represented as 208.5729167. I would like to convert this to a visual that is easier to interpret such as mm/dd/yyyy HH:MM. I've searched around and the closest function I've found converts a date to doy.
Thanks in advance
Accepted Answer
More Answers (1)
Peter Perkins
on 27 Jul 2015
In R2014b or later, you can use datetime and duration:
>> d = datetime(2013,1,1) + days(208.5729167)
d =
28-Jul-2013 13:45:00
But bear in mind that in double precision, hours, minutes, and seconds are not exactly representable as fractions of days. Hope this helps.
Categories
Find more on Dates and Time 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!