I have a mysql date (yyyy-mm-dd). I want to know the date 30 days prior. How do I do that? Is it as simple as subtracting 30?
$chkdate = '2010-03-21; $newdate = $chkdate - 30;
Probably the easiest way is to do it as part of the query, using the DATE_SUB() function in MySQL.
Note that you can also simply use the addition/subtraction operators in a MySQL query, e.g.:
dateCol - INTERVAL 30 DAY