I am trying to get difference of two dates to count the duration of time.
This is my code:
$start_time = '2016-11-02 14:15:02';
$end_time= '2016-11-02 14:17:02';
$diff= strtotime($end_time) - strtotime($start_time);
$duration = date("H:i:s", $diff);
gmdate instead of
date. It returns formated date string.
$duration = gmdate("H:i:s", $diff);