$today = strtotime(date("Y-m-d"),time()); $day=date("Y-m-d H:i:s",$today);//当日凌晨的时间戳 计算时间差: $day1="2018-3-18 18:00:00"; $hour=floor((strtotime($day)-strtotime($day1))%86400/3600); echo $hour;