In my table I've got a column called 'time_handled' and in there is a MySQL timestamp. On another page I want to run a query that brings up records where the time_handled is over 1 hour old.
So far I've tried this:
SELECT * FROM table WHERE time_handled < NOW() - 3600
This worked for a bit but as soon as the clock changed from 16:59 to 17:00 the server started showing records less than 1 hour old again. I think it's something to do with how MySQL treats NOW() when used as an integer.
Does anyone out there know the correct way to do this?
Question
simsie
Hello,
In my table I've got a column called 'time_handled' and in there is a MySQL timestamp. On another page I want to run a query that brings up records where the time_handled is over 1 hour old.
So far I've tried this:
This worked for a bit but as soon as the clock changed from 16:59 to 17:00 the server started showing records less than 1 hour old again. I think it's something to do with how MySQL treats NOW() when used as an integer.
Does anyone out there know the correct way to do this?
Thanks,
Simsie
Link to comment
Share on other sites
7 answers to this question
Recommended Posts