Hi,
I have it worked out, though it may not be the best way.
function FormatHours($row)
{
$StartShift = strtotime($row["StartShift"]);
$FinishShift = strtotime($row["FinishShift"]);
$Diff = $FinishShift - $StartShift;
return str_pad(floor($Diff / 3600),2,"0",STR_PAD_LEFT).":".str_pad(($Diff % 3600 / 60),2,"0",STR_PAD_RIGHT);
}
This gives me a result in hh:mm format.
eg. If the shift started at 09:30 and finished at 17:00 then this would return 07:30, the number of hours worked.
If anyone has any comments or a better way, please let me know.
Thanks,
Rod