How i can select from database the items older than 12 hours?! I using a timestamp column to store the time but I don't think i need year,month,day only hours I have something like this but it dosen't work (no error just returning all data from table)
$sql = "SELECT *FROM Y WHERE X and time > now() - INTERVAL 12 HOUR";
Type : timestamp
You're right Salman A .Thanks
Try this :
SELECT * FROM Y WHERE X and time < (NOW() - INTERVAL 12 HOUR)
you need <
rather than >
as you want to select records older than 12 hours
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With