这是我的方式
要找到它,你可以这样做
步骤1 :
找到本周的开始和最后一天
$FirstDay = date("Y-m-d", strtotime('sunday last week'));
$LastDay = date("Y-m-d", strtotime('sunday this week'));
第2步 :
查看给定日期是否在本周的开始日期和最后一天之间
if($Date > $FirstDay && $Date < $LastDay) {
echo "It is Between";
} else {
echo "No Not !!!";
}
If Yes then It belongs Else Not
所以,最后你应该拥有的代码是
$Date = "2015-06-01"; #Your Own Date
$Date = date('Y-m-d'); #Or Current Date Fixed here
$FirstDay = date("Y-m-d", strtotime('sunday last week'));
$LastDay = date("Y-m-d", strtotime('sunday this week'));
if($Date > $FirstDay && $Date < $LastDay) {
echo "It is Between";
} else {
echo "No Not !!!";
}
?>
注意
>您可以拥有自己的开始日,即周日或周一>您可以拥有自己的日期或当前日期