TIMESTAMP and COMPARISON
| From: | chris allen | Date: | Wed, 20 Mar 2002 19:53:18 +0000 |
| Subject: | TIMESTAMP and COMPARISON | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-89390@lists.php.net to get a copy of this message | ||
Hello,
I am looking for a standard way to compare to dates. I have a date/time
stored in a field in a mysql table as
date_added TIMESTAMP(14)..... (IE yyyymmddhhmmss).
I want to delete all records in this table if date_added is older than 2
hours.
IE
if current_date > date_added +2 hours then delete record.
How do I do this from within mysql?
Do I need to go outside of mysql and code it in php to do this?
I read that mysql wants calculations done on the app side as compared to the
server side.
What do others do with these kind of situations?
It appears that if I have to bring data out of the table and do a comparison
it wouldnt be efficient.
Thanks,
ccma