Hi,
I have this rails query:
@birthdays = Birthday.find :all,
:conditions => ["user_id = ? and
birthdate = ''2006-02-01'', @user_id],
:limit => @birthday_pages.items_per_page,
:offset => @birthday_pages.current.offset
You can ignore the user_id, limit and offset part. Birthdate is date
type. That query lists the row which birthdate is 2006-02-01. How do I
extract month from birthdate column; something like this:
.... birthdate.month = 2 .....
I want to query all the rows which in February or another month.
I have though the solution; something like this:
.... birthdate >= start_of_the_month and birthdate <= end_of_the_month
.... ( we find start and end of the month from ruby )
but maybe rails has simpler way....
Thank you.