I have a table \"users\" with a column \"date_of_birth\" (DATE format with day, month, year). In frontend I need to list 5 upcoming birthdays.
Spent ages trying to w
It's better to use SQL to make this query:
next_month = (Date.today + 1.month).month # or use any other integer users_having_birhtday_next_month = User.where("EXTRACT(MONTH FROM date_of_birth) = ?", next_month)
Note: EXTRACT - PostgreSQL function