yahn Posted July 6, 2006 Share Posted July 6, 2006 I'm inserting NOW() into a mysql database and when I query that timestamp out, I want to see if NOW() then was 15 minutes ago. I don't know how to do that, so can anyone tell me? Quote Link to comment https://forums.phpfreaks.com/topic/13900-dealing-with-timestamp-solved/ Share on other sites More sharing options...
toplay Posted July 7, 2006 Share Posted July 7, 2006 It would be something like the example below. Rows will get selected when the timestamp value in your column_name is older or equal to 15 minutes from the current date/time.SELECT * FROM table_name WHERE column_name <= DATE_SUB(NOW(), INTERVAL 15 MINUTE)You didn't post your MySQL version, however, you can look at all the date and time functions here:http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html Quote Link to comment https://forums.phpfreaks.com/topic/13900-dealing-with-timestamp-solved/#findComment-54172 Share on other sites More sharing options...
yahn Posted July 7, 2006 Author Share Posted July 7, 2006 Thank you. That worked perfectly. Quote Link to comment https://forums.phpfreaks.com/topic/13900-dealing-with-timestamp-solved/#findComment-54179 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.