Jeff Oien wrote:
When I do this: $lastmonth = mktime(0, 0, 0, date("m")-9, date("d"), date("Y"));
this will not work most of the year, if current month is August or less, the month value will be negative.
Use strtotime('-9 months') instead.
This code works just fine for me:
$nine_months_ago = mktime(0, 0, 0, date("m")-9, date("d"), date("Y")); echo date("m/d/Y", $nine_months_ago);
If today is March 21, 2004, then this outputs "06/21/2003". That's exactly nine months ago.
See http://www.php.net/date
-- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php