Jump to content

MySQL compare dates against strtotime?


Perad

Recommended Posts

I think it's

SELECT * FROM posts WHERE date >= DATE_SUB(NOW(), INTERVAL 2 DAY);

 

Also, I highly recommend doing date comparisons either all in SQL or all in PHP, since the times (on a badly configured server) may be different in the two contexts. I've seen it happen before.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.