Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如,我有两次启动时间为上午 9 点,结束时间为下午 1 点,我从下拉列表中获得了两次。如何仅以小时为单位找到这两次之间的差异。
$to_time = strtotime("09:00:00"); $from_time = strtotime("13:00:00"); echo round(abs($to_time - $from_time) / 60 / 60 ,2). " Hours";
如果您不确定是否可以使用 24 小时格式转换您的时间
$time_in_24_hour_format = date("H:i", strtotime("1:00 PM"));