开发者

ASP Date Comparison

开发者 https://www.devze.com 2023-03-19 21:47 出处:网络
Here is the code. <% expire_date = Session(\"expiration_date\") current_date = date() If current_date >= expire_date Then

Here is the code.

<%

expire_date = Session("expiration_date")
current_date = date()

If current_date >= expire_date Then
response.Redirect("../login_expiration.asp")
Else
' do n开发者_运维问答othing
End If

%>

Assuming the expiration date is 7/10/2011, what should happen? I expect the redirect to happen, but the opposite does. If I change the operator to "<=", the redirect happens.

What am I missing?

Thanks

Brett


You may need to cast Session("expiration_date") from a string to a date:

expire_date = CDate(Session("expiration_date"))

0

精彩评论

暂无评论...
验证码 换一张
取 消