PHP 获取时间差

$bean->StopTime=date("Y-m-d H:i:s");// 当前时间


$one = strtotime($bean->StartTime);
$tow = strtotime($bean->StopTime);
$len = $tow - $one;      //得出时间戳差值
$bean->TimeLen=$len; //时间差  秒

date_default_timezone_set('asia/chongqing');  //系统时间 差8小时 问题

原文地址:https://www.cnblogs.com/hailexuexi/p/1817419.html