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-mm-dd is in.
For example, if I got 2012-10-11 as $date and 5 as $day, I want to get 2012-10-12, if I’ve got 0 as $day, 2012-10-14
EDIT:
Most of you misunderstood it. I got some date, $date and want to get a day specified by 0-6 of the same week $date is in.
So no, I don’t want the day of $date…
I think this is what you want.