📜  两个时间戳之间的区别php代码示例

📅  最后修改于: 2022-03-11 14:54:23.350000             🧑  作者: Mango

代码示例1
$datetime1 = new DateTime('2016-11-30 03:55:06');//start time
$datetime2 = new DateTime('2016-11-30 11:55:06');//end time
$interval = $datetime1->diff($datetime2);
echo $interval->format('%Y years %m months %d days %H hours %i minutes %s seconds');//00 years 0 months 0 days 08 hours 0 minutes 0 seconds