get all the month between 2 year in ruby on rails

i take the current date and find the last year in ruby with 1.year.ago. so i got 2 years 2010-12-14 to 2011-12-14. My question is how to get all the months between these two dates in ruby in rails…? also these dates will change depend on the current system date…

thank you

vishnu

What have you tried? Where have you looked for solutions? What problems have you encountered?

Have a look at the documentation for the Time class, there are many methods that you can use. When you say you want to "get" the date do you mean you want it in a variable or you want to convert it to a string for display? If you want it in a variable then you can make a new Time object using day, month, year from original one (leaving hours, mins, seconds as zero so it represents the start of the day). If you want it as a string then look at strftime.

Colin