3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $star = '2014-11-02 01:01:01'; $finish = '2014-11-02 02:02:02'; $s = strtotime($star); $f = strtotime($finish); $e = $f-$s; echo sec2date($e); function sec2date($secs) { $sec = $secs%60; $jam = intval($secs/3600); $menit = intval($secs/60)%60; $sec = ($sec < 10)?"0$sec":"$sec"; $jam = ($jam < 10)?"0$jam":"$jam"; $menit = ($menit < 10) ? "0$menit" : "$menit"; return "$jam:$menit:$sec"; }
based on NmDLS
Output for 4.3.0 - 7.1.0
01:01:01