in reply to Working with mySQL date's

Probably will be easier to do just using functions in mySQL, with less brain damage. As an example, I found this in the mySQL online documentation, which may suggest a course for you (first example on that page):

mysql> SELECT something FROM tbl_name WHERE TO_DAYS(NOW()) - TO_DAYS(date_col) <= 30;

Using that as a basis, you could do something like:

mysql> DELETE FROM tbl_name WHERE TO_DAYS(NOW()) - TO_DAYS(date_col) > 31;

Hope that helps. (The use of that code from a perl script is left as an exercise for the reader. :)

Replies are listed 'Best First'.
Unix timestamp goodness
by Anonymous Monk on Jul 03, 2003 at 19:44 UTC
    I find myself using unix timestamps to store dates in unsigned ints instead of the MySQL date type. It has less trouble with timezone of the db vs timezone of the web server. Besides, to display a localized format and timezome I need to convert through a unix timestamp anyway. Intervals are also easier.

    WHERE UNIX_TIMESTAMP() - UNIX_TIMESTAMP(date_col) > 31*86400;