How can I use DATE() in Doctrine 2 DQL?

In addition to the accepted answer there are a tonne of pre-built custom functions available at https://github.com/beberlei/DoctrineExtensions .

These can be then registered in your config like

doctrine:
    orm:
        dql:
            string_functions:
                DATE: DoctrineExtensions\Query\Mysql\Date

and can then be used in your DQL (as in your query) like

DATE(jobs.endDate) AS endDate

Leave a Comment