Home > php教程 > php手册 > 判断一个时间段是否包含周末

判断一个时间段是否包含周末

WBOY
Release: 2016-06-07 11:36:14
Original
1551 people have browsed it

有两个已知时间戳。判断该时间戳内是否包含周六周天。
/**
*判断时间段是否有周末。原创,更多请访问:www.ichasem.com
* @author winter
* @version 2015年10月10日17:36:27
* @param begin 开始时间
* @param last 结束时间
*/

public function isWeek($begin,$last){
$span = intval($last-$begin);
if($span >= 604800){
return 1;
}else if($span > 0){
$lWeek = date(‘w’,$last);
$bWeek = date(‘w’,$begin);
if($lWeek == 6 || $lWeek == 0 || $bWeek == 6 || $bWeek == 0){
return 1;
}else{
if($bWeek > $lWeek){
return 1;
}else{
return 0;
}
}
}

}

AD:真正免费,域名+虚机+企业邮箱=0元

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