我必须验证过去六个小时的一些值,所以让它像:
$last_six_hours = (time() - (3600 *6));
如果我必须与16hs这样的整数进行比较,那么最好的方法是什么?
strtotime()
获取相对数量并返回unix时间戳:
$four_o_clock = strtotime('16:00:00');
if ($sometimestamp > $four_o_clock) {
// it happened after 16:00:00 today
}
我必须验证过去六个小时的一些值,所以让它像:
$last_six_hours = (time() - (3600 *6));
如果我必须与16hs这样的整数进行比较,那么最好的方法是什么?
strtotime()
获取相对数量并返回unix时间戳:
$four_o_clock = strtotime('16:00:00');
if ($sometimestamp > $four_o_clock) {
// it happened after 16:00:00 today
}