asp中时间函数的应用问题

来源:百度知道 编辑:UC知道 时间:2024/06/03 22:46:01
请问我下面写的语句错在哪了?应该怎么改?(就是判断一个日期,然后调用不同的页面)
<%if now>2008-05-18 then Response.Redirect "index1.html"
else Response.Redirect "index2.html"%>
谢谢~~~~~~~~~~~~~
非常感谢两位的迅速解答,不过两位的办法都不能得到正确的页面转向
我使用以下的代码
<%
If Year(Now)&"-"&Month(Now)&"-"&Day(Now) > 2008-05-21 Then
Response.Redirect "index1.html"
Else
Response.Redirect "index2.html"
End If
%>
却转到index1.html页面(今天才19号啊)

<%
If Year(Now)&"-"&Month(Now)&"-"&Day(Now) = 2008-5-18 Then
Response.Redirect "index1.html"
Else
Response.Redirect "index2.html"
End If
%>

=========================

没错的,日期比对的话~`时间早的比现在的时间大~`

<%if formatedatetime(now,2)>date(2008-05-18) then Response.Redirect "index1.html"
else
Response.Redirect "index2.html"
end if%>

晕死。
时间2008-05-21是字符串来的,要用""引起来。 如果不行的话可以加个:CDATE()转为时间。

改为这样:
<%
If Year(Now)&"-"&Month(Now)&"-"&Day(Now) > cdate("2008-05-21") Then
Response.Redirect "index1.html"
Else
Response.Redirect "index2.html"
End If
%>