Check the manual:
http://us3.php.net/manual/en/function.date.php
It is possible to use date() and mktime() together to find dates in the future or the past.
Example 438. date() and mktime() example
<?php
$tomorrow = mktime(0, 0, 0, date("m") , date("d")+1, date("Y"));
$lastmonth = mktime(0, 0, 0, date("m")-1, date("d"), date("Y"));
$nextyear = mktime(0, 0, 0, date("m"), date("d"), date("Y")+1);
?>
And one that should do the trick for you:
<?php
$day=17;
$month=8;
$year=2007;
$d=date("Y-m-d",mktime(0,0,0,$month,$day-2,$year));
print $d;
?>