I'm trying to use start time and end time captured in these variables. I'd like to add these values together to get an overall time spent on variouse tasks. So I got these values and am trying to do something like this:
//start times
$time_1 = $_POST['start_of_service_1'];
$time_2 = $_POST['start_of_service_2'];
$time_3 = $_POST['start_of_service_3'];
//end times
$etime_1 = $_POST['end_of_service_1'];
$etime_2= $_POST['end_of_service_2'];
$etime_3 = $_POST['end_of_service_3'];
//total hours
$tot_hours_1 = date('H:i',strtotime($etime_1)-strtotime($time_1);
$tot_hours_2 = date('H:i',strtotime($etime_2)-strtotime($time_2));
$tot_hours_3 = date('H:i',strtotime($etime_3)-strtotime($time_3));
$totaltime = $tot_hours_1 + $tot_hours_2 + $tot_hours_3
So if the time spans are each 5 minutes, it would be 00:05 + 00:05 + 00:05 = 00:15 minutes total.
These time functions seem so tricky I'm having awful troubles and time spent to overcome this obstacle.
Can anyone give me advice on how to accomplish this?