开发者

Doctrine: calculating datetime difference

开发者 https://www.devze.com 2023-03-12 15:33 出处:网络
How can i calculate the difference between datetime column and now (for example \'created_at\' and NOW()) in Doctrine?

How can i calculate the difference between datetime column and now (for example 'created_at' and NOW()) in Doctrine?

I Googled it alot and couldn't find an answer..

Th开发者_如何学Goanks in advance!


Have you tried this?

$query->select('DATEDIFF(NOW(), datetime column)')


try $query -> select(DATE_DIFF(CURRENT_DATE(), datetime column))

DQL dont use now() sql function, they use CURRENT_DATE() instead

0

精彩评论

暂无评论...
验证码 换一张
取 消