MichiganRon
MIS
I have a table that contains data which expires after a certain period of time. I have a PHP script which runs a query to delete records older than a certain date/time. This date/time is given in unix timestamp format.
The table has a field of "datetime" format named "starttime". I want to do something like this:
DELETE FROM messages WHERE starttime < $expiretime
Unfortunately when I do this, it doesn't work because the query appears to pull the data from the starttime field in a different format than unix timestamp.
I know that there are many different date/time functions that can be used in MySQL sql statements. I am looking for the most efficient way to compose this query.
Any help would be greatly appreciated.
“If you are irritated by every rub, how will you be polished?” ~ Mevlana Rumi
Do you live in Michigan? Join us in the Tek-Tips in Michigan forum.
The table has a field of "datetime" format named "starttime". I want to do something like this:
DELETE FROM messages WHERE starttime < $expiretime
Unfortunately when I do this, it doesn't work because the query appears to pull the data from the starttime field in a different format than unix timestamp.
I know that there are many different date/time functions that can be used in MySQL sql statements. I am looking for the most efficient way to compose this query.
Any help would be greatly appreciated.
“If you are irritated by every rub, how will you be polished?” ~ Mevlana Rumi
Do you live in Michigan? Join us in the Tek-Tips in Michigan forum.