If I use the Following code in PHPMyAdmin (SQL) statement, it works and I get a list of all Birthdays of the following 31 days. Here is my code:
SELECT
*
FROM
membres
WHERE
DATE_ADD(
date_de_naissance,
INTERVAL
YEAR(CURDATE()) -
YEAR(date_de_naissance) +
IF(DAYOFYEAR(CURDATE()) > DAYOFYEAR(date_de_naissance), 1, 0)
YEAR
)
BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 31 DAY)
AND
(
MONTH(date_de_naissance) <> MONTH(CURDATE())
OR
DAY(date_de_naissance) <> DAY(CURDATE())
)
How would it be in Cakephp? Please help
I generally find it's much easier to do the date math in CakePHP than in MySQLs, so I'd do something like this: