函数源代码:
---------------------------------------------
说明:若$varTime在今天的范围内,返回ture,否则返回false.
function bTodayToTomorrow($varTime)
{
$nowYear=date("Y");
$nowMonth=date("n");
$nowDay=date("j");
$aryTodayAndTomorrow["Today"]=date("U",mktime(0,0,0,$nowMonth,$nowDay,$nowYear));
$aryTodayAndTomorrow["Tomorrow"]=date("U",mktime(0,0,0,$nowMonth,($nowDay+1),$nowYear));
if($varTime>=$aryTodayAndTomorrow["Today"]&&$varTime<$aryTodayAndTomorrow["Tomorrow"])
{
return true;
}
else
{
return false;
}
}
------------------
类似的你可以进行任意时间段的判断。
文章来源于领测软件测试网 https://www.ltesting.net/