Home >Backend Development >PHP Tutorial >PHP判断指定时间段的2个方法_php实例

PHP判断指定时间段的2个方法_php实例

WBOY
WBOYOriginal
2016-06-07 17:21:20977browse

一、包含小时和分钟的判断

复制代码 代码如下:
date_default_timezone_set("Asia/Shanghai");
$time = intval (date("Hi"));
if ($time > "800" && $time     // code
}

二、只判断小时
复制代码 代码如下:
date_default_timezone_set("Asia/Shanghai");
if(date('G')17)
{
    // code
}$h = intval(date("H"));
if ($h > 23 || $h  echo '这里是第一个任务';
} else {
 echo '这里是第二个任务';
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn