I am trying to subtracting two variables in PHP (time format, "H:i:s"), i.ex:
$entryscan = '07:15:00';
$exitscan = '16:35:00';
$workduration = $exitscan - $entryscan;
$workduration = '09:20:00';
Use php timediff function.
$datetime1 = new DateTime($entryscan); $datetime2 = new DateTime($exitscan); $interval = $datetime1->diff($datetime2); echo $interval->format('%H hours');
%H will give you the difference in hours.
%I will give you the difference in minutes.
%S will give you the difference in seconds.