Php日期和小时问题

I want to display the time between two datetime like this:

$diff = strtotime('2014-06-30 15:23:19') - strtotime('2014-06-30 15:20:16');
echo "time: ".date('H:i:s', $diff);

The result is :

time: 01:03:03

I don't understant why the hours display '01' ?? I tried with 'h:i:s' or 'g:i:s' but it doesn't work.

I would like this result:

time: 00:03:03

Have a look at the built in DateTime::diff functions of php.

You could do something like:

$time1 = new DateTime('2014-06-30 15:20:16');
$time2 = new DateTime('2014-06-30 15:23:19');

$diff = $time1->diff($time2);