this works with valid work hours date times greater than one hour differnce needs refining
its not in a function and will probebly require changng the date input formats but should put you going in some direction
$starttime=strtotime("mon, 9 aug 2004 16:00:00");
$endtime=strtotime("wed, 11 aug 2004 10:00:00");
for($i=$starttime;$i<$endtime;$i+=86400)
{
$dtime=date("w G i",$i);
list($day,$hours,$mins)=explode(" ",$dtime);
if($i==$starttime)
{
$difh=17-$hours;
$difm=($difh*60)-$mins;
$hold=480-$difm;
}
elseif($day >0 && $day <6)
$difm=$difm+480;
}
for($j=$i-($hold*60);$j<$endtime;$j+=3600)
{$day=date("w",$j);
if($day >0 && $day <6)
$difm=$difm+60;
}
$dif=($difm/60);
echo $dif." Hours have past";