Archive for October 2nd, 2009

You can use this in your MySQL WHERE clause to return records that were created within the last 7 days/week:
1created >= DATE_SUB(CURDATE(),INTERVAL 7 day)
You can also use NOW() in the subtraction to give hh:mm:ss resolution. So to return records created exactly (to the second) within the last 24hrs, you could do:
1created >= DATE_SUB(NOW(),INTERVAL 1 day)


top