1
我在基于两个预先指定的时间比较当前时间时遇到问题。让我告诉我想要什么: 如果当前时间在晚上10点到上午8点之间,我想显示一条消息。而我的代码是PHP strtotime()并根据两个给定时间比较当前时间
$current_time = strtotime('now');
if ($current_time > strtotime('10:00pm') && $current_time < strtotime('8:00am')) {
//Display message
}
但它不工作,因为,经过上午12:00,的strtotime('10:00')是计算今天的10PM价值,是不能够在给定的条件通过。所以我需要你的建议。
从的strtotime返回的值()包含的最新信息数据,这是实际问题 – Shin 2013-05-09 06:00:23
你想下午10:00 - 8:00 AM(第二天)??? – Shin 2013-05-09 06:04:21
是的,正确。 – IFightCode 2013-05-09 11:49:55