Jump to content


Photo

dealing with timestamp *SOLVED*


  • Please log in to reply
2 replies to this topic

#1 yahn

yahn
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 06 July 2006 - 09:58 PM

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?

#2 toplay

toplay
  • Staff Alumni
  • Advanced Member
  • 973 posts

Posted 07 July 2006 - 12:14 AM

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...-functions.html



#3 yahn

yahn
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 07 July 2006 - 12:55 AM

Thank you.  That worked perfectly.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users