How to calculate time difference (duration) between 2 times
Php code :
$in_time = date('H:i', strtotime($ci_time_a[$i])); // date('H:i', strtotime('9:00'))
$out_time = date('H:i', strtotime($co_time_a[$i])); // date('H:i', strtotime('6:00'))
$datetime1 = new DateTime($out_time);
$datetime2 = new DateTime($in_time);
$interval = $datetime1->diff($datetime2);
echo $interval->format('%h') . " Hours " . $interval->format('%i') . " Minutes";