first set a timestamp on the returned value
use the date function to determine what day of the week it is
$TimeStamp= returnedvalue;
$dayofweek=date("w",$TimeStamp)
5 is Friday
rebuild the date with mktime() function by getting current day of month and adding the difference between the $dayofweek and 5 to it
from php manual under date()
w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)
Hope this helps