Home > php教程 > php手册 > PHP判断指定时间段的2个方法

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

WBOY
Release: 2016-06-13 09:40:51
Original
833 people have browsed it

 有时我们需要在一天中的某个时间段进行某项任务,或者在一天中的不同小时里进行不同的任务,使用PHP如何实现呢,下面的两个例子都可以解决这个问题

一、包含小时和分钟的判断  代码如下:date_default_timezone_set("Asia/Shanghai"); $time = intval (date("Hi")); if ($time > "800" && $time 17) {     // code }$h = intval(date("H"));  if ($h > 23 || $h
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template