Topic: Dates (each month question)

So I want to get an array of month/year for each month/year since a timestamp...

The below kind of works... but it seems stupid to loop through every single day just to get months...    Is it possible just to get the months in between given 2 dates ?

>> l.created_on.to_date.upto (Date.today) do |tm|
?> puts tm if tm.day == 1
>> end
2006-08-01
2006-09-01
2006-10-01
2006-11-01
2006-12-01
2007-01-01
2007-02-01
2007-03-01
2007-04-01

Last edited by timmaah (2007-04-08 20:54:14)