求一段关于时间的脚本代码

来源:百度知道 编辑:UC知道 时间:2024/05/26 02:37:19
要实现的功能:要限制浏览者只能在规定的时间内浏览网站,或者网站内的某一页面,其他时间将不能浏览!
注意:时间的确定一定要与服务器的时间一致
ASP代码的
谢谢

<%
nowtime=hour(time())&":"&minute(time())
if cdate(order_sendtime)<cdate(DateAdd("n",50,nowtime)) then
%> ------------------------获取服务器时间脚本

<%
TimeA=date()&" 20-00-00"
TimeB=date()+1&" 8-00-00"

if now()>TimeA or now()<TimeB then
response.write "对不起,晚20点之后到早8点之前不允许访问"
end if
%>

ASP
<%= Date() %> 取得当前的日期
<%= Now() %> 取得当前的日期和时间

ASP.NET
<%= System.DateTime.Today() %>取得当前的日期
<%= System.DateTime.Now() %>取得当前的日期和时间

取服务器的时间!
找了一个曾经做的例子,你可以看一下!
<%
nowtime=hour(time())&":"&minute(time())
if cdate(order_sendtime)<cdate(DateAdd("n",50,nowtime)) then
%>
<script language=javascript>
alert("订单提交失败:您选择的送餐时间必须是当前时间的50分钟以后!");
history.go(-1);
</script>
<%
end if
bfive=year(now())&&