If I\'ve got a $date YYYY-mm-dd and want to get a specific $day (specified by 0 (sunday) to 6 (saturday)) of the week that YYYY-
$date
YYYY-mm-dd
$day
YYYY-
Just:
2012-10-11 as $date and 5 as $day
The $result = '2012-10-12' is what you want.