ASP Date Comparison
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"))
精彩评论