What is the best way to get the day of the year for any specific date in Ruby?
For example: 31/dec/2009 should return day 365, and 01/feb/2008 should return day 32
What is the best way to get the day of the year for any specific date in Ruby?
For example: 31/dec/2009 should return day 365, and 01/feb/2008 should return day 32
You can use time without importing anything:
Time.new(1989,11,30).yday
or for now:
Time.now.yday