0

i have two time like total worked time and total duty time. eg.

$dutyTime= 182:00:00; ("H:i:s")  
$workedTime= 178:10:28; ("H:i:s")  

my question is that how can i get difference between this two time;

Expected Output

$duration=03:49:32; ("H:i:s")

i tried strtotime() but i takes upto 24hrs.

Karan
  • 1,146
  • 1
  • 10
  • 24

1 Answers1

1
<?php
$start  = date_create('21:21:05');  //start time
$end    = date_create('10:20:00'); // end time
$diff   = date_diff( $start, $end );

$date= $diff->h.':'.$diff->i.':'.$diff->s;
echo date("H:i:s",strtotime($date));
?>