VisaMasterCard
VisaMasterCard

Reputation: 1696

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-01-31 22:18:40

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

Any ideas?

Upvotes: 0

Views: 102

Answers (3)

Jan
Jan

Reputation: 2293

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

Upvotes: 0

Prisoner
Prisoner

Reputation: 27618

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

Upvotes: 0

a1ex07
a1ex07

Reputation: 37364

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

Upvotes: 2

Related Questions