$ php app/console doctrine:query:dql 'SELECT now()'
$ php应用/控制台原则:查询:dql 'SELECT now()'
[Doctrine\ORM\Query\QueryException] [Syntax Error] line 0, col 7: Error: Expected known function, got 'now'
[Doctrine\ORM\查询\QueryException][语法错误]第0行,col 7: Error: Expected known function, got 'now'
How can I manage to use the MySQL now() function with Doctrine DQL?
如何使用具有Doctrine DQL的MySQL now()函数?
1 个解决方案
#1
98
The equivalent of MySQL's NOW()
is Doctrine DQL's CURRENT_TIMESTAMP()
.
与MySQL的NOW()等价的是Doctrine DQL的CURRENT_TIMESTAMP()。
CURRENT_DATE()
only returns the date part.
CURRENT_DATE()只返回日期部分。
#1
98
The equivalent of MySQL's NOW()
is Doctrine DQL's CURRENT_TIMESTAMP()
.
与MySQL的NOW()等价的是Doctrine DQL的CURRENT_TIMESTAMP()。
CURRENT_DATE()
only returns the date part.
CURRENT_DATE()只返回日期部分。