开发者

Retrieving Date format rows in MySQL

开发者 https://www.devze.com 2023-02-09 02:38 出处:网络
I need to make a test on a Date field, so I can get the rows older than 29 days. My Date field has this format : 2011-0开发者_StackOverflow中文版1-31 22:18:40

I need to make a test on a Date field, so I can get the rows older than 29 days.

My Date field has this format : 2011-0开发者_StackOverflow中文版1-31 22:18:40

SELECT addeddate FROM status
WHERE addeddate // something to test if addeddate >= 29 days

Any ideas?


SELECT addeddate FROM status
WHERE addeddate <= NOW() - INTERVAL 29 DAY


Something like: WHERE addeddate > DATE_SUB(NOW(), INTERVAL 29 DAY)


SELECT addeddate FROM status
WHERE DATEDIFF(NOW(), addeddate) >= 29
0

精彩评论

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

关注公众号