如果你想根据时间来判断某一时间值(用秒数表示)是否在今天的范围之内。下面这个函数,将帮你轻而易举的判断。
函数源代码:
---------------------------------------------
说明:若$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;
}
}
------------------
类似的你可以进行任意时间段的判断。
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器