ruby - Rails, day of year to date -


i have day of year. example 15th day of 2014, or 210th day of 2014. need date on particular day. there library function in rails/ruby can use, or other elegant way?

something like:

15th day of 2014 = 15-jan-2014

210th day of 2014 = 29-jul-2014

you can use date.ordinal that:

require 'date'  date.ordinal(2014, 210) # => #<date: 2014-07-29 ((2456868j,0s,0n),+0s,2299161j)> 

Comments