开发者

Retrieving Date format rows in MySQL

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜