Convert day of year to date

Tomas picture Tomas · Jun 13, 2014 · Viewed 12.2k times · Source

How do I convert day-of-year to date? For example, what's the date for 104th day of 2004?

This is the opposite of How do you convert POSIX date to day of year in R?

Answer

user2739472 picture user2739472 · Aug 22, 2016

I found that @TMS answer ignores the year specified in the origin, replacing it with the actual year you are executing the command (as @Shekeine found). Doing this seems to work fine though:

as.Date(104, origin = "2014-01-01")

CAUTION: day-of-year is zero based in this case!