Hi again fellas!
Found the following snippet online and are currently using it in my web application, however it returns time like "0:5:1". I would like it to format the output like a real date, ie: 00:05:01.
Guess that there is an embarrassing quick solution to solve this. Here comes the snippet:
function getTimeDifference($start, $end) {
$uts['start'] = $start;
$uts['end'] = $end;
if( $uts['start']!==-1 && $uts['end']!==-1 )
{
if( $uts['end'] >= $uts['start'] )
{
$diff = $uts['end'] - $uts['start'];
if( $hours=intval((floor($diff/3600))) )
$diff = $diff % 3600;
if( $minutes=intval((floor($diff/60))) )
$diff = $diff % 60;
$diff = intval( $diff );
return $hours . ':' . $minutes . ':' . $diff;
}
else
{
return FALSE;
}
}
else
{
return FALSE;
}
return FALSE;
}
Thanks a lot!