tags:

views:

20

answers:

1

There's any way to get the next birthdays using only DQL (Doctrine Query Language)? I solve the problem using the SQL function DAYOFYEAR but I think that's not correct because that only work on MySQL and if I have to migrate to MSSQL (for example) that doesn't work.

Thanks in advanced.

A: 

You don't really need the function from MySQL. Simply use PHP's date function and use format "z". Quoting the PHP docs:

z -> The day of the year (starting from 0) -> 0 through 365

Alternatively, you can also use strftime with "%j" (or anything else that suits you)

DrColossos