Php 如何检查时间戳中的小时数是否在特定的小时数范围内?
可能重复:Php 如何检查时间戳中的小时数是否在特定的小时数范围内?,php,datetime,timestamp,Php,Datetime,Timestamp,可能重复: 我有一个时间戳,格式如下: 1330559989 如何检查时间戳中的小时数是否在6小时到23小时之间 有人能帮我吗?日期('H',1330559989)将以24小时格式为您提供小时数,前导为零,在本例中:23 还有一个特定的时间戳小时函数,它为该信息()提供了一个数组接口: 如果要检查从现在到给定时间戳之间的时间,则可以使用: <?php echo date("H", strtotime(now)-1330559989); // Displays the diffe
我有一个时间戳,格式如下:
1330559989
如何检查时间戳中的小时数是否在6小时到23小时之间
有人能帮我吗?日期('H',1330559989)
将以24小时格式为您提供小时数,前导为零,在本例中:23
还有一个特定的时间戳小时函数,它为该信息()提供了一个数组接口:
如果要检查从现在到给定时间戳之间的时间,则可以使用:
<?php
echo date("H", strtotime(now)-1330559989); // Displays the difference from now.
echo date("H", 1330559989); // Displays that time!
?>
希望这有帮助!:) $hrs=日期('H',1330559989);
如果($hrs>=6&&$hrs
<?php
echo date("H", strtotime(now)-1330559989); // Displays the difference from now.
echo date("H", 1330559989); // Displays that time!
?>
$hrs=date('H', 1330559989);
if ($hrs>= 6 && $hrs<= 23) {
// your code
}