MySQL DATETIME DIFF query

我的梦境 提交于 2019-12-01 03:20:11

Try timediff with a 48 hours delta instead . Or use a 3 days delta if precision is not an issue.

Try HOUR(TIMEDIFF(NOW(), date))

SELECT count(*) FROM $wpdb->posts WHERE post_type = 'rentals' AND HOUR(TIMEDIFF(NOW(),  post_date_gmt)) >=48

There is a lot of MySQL date/time function : http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_hour

Note: use SELECt before trying DELETE

you can DATEDIFF(NOW(), post_date_gmt) >= 3 and it will be deleted 48 and half hours old

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!