group objects by month

I have a collection of of objects from an query. I can group them by using:


that works fine... and it groups them by date, however, I want to group them by month. How can I do this?

or group by week for that matter...

If :birth_date is a Date, for instance, you could do it like this:

@dogs.group_by{|dog| dog.birth_date.month}