How to sum up time in php. For example I have this series of time duration logs:
00:10:00
00:30:10
01:00:50
The total should be 1 hour and 41 minutes Here is my code:
$log_in = new DateTime($log->log_in);
$log_out = new DateTime($log->log_out);
$diff = $log_out->diff($log_in);
$total += strtotime($diff->format('%H:%i:%s'));
echo $diff->format('%H:%i:%s');