Date formatting/checking

Soldato
Joined
28 Dec 2004
Posts
7,620
Location
Derry
Hi there, I'm completely stuck on this as I haven't touched ASP in years now.

I'm basically trying to check if a date pulled from a database is "less than" todays date, unfortunately this doesn't work

<% if Date() > (Recordset1.Fields.Item("AvailabilityDate").Value) then
response.write(" Immediately ")
else
response.write(Recordset1.Fields.Item("AvailabilityDate").Value)
End if
%>

Any ideas?

TIA.
 
DateDiff will help, but also make sure the variables you're comparing are of the same subtype - e.g.
Code:
<% if Date() > cdate(Recordset1.Fields.Item("AvailabilityDate").Value) then...
In ASP, even though everything is a variant, 1 !== "1".
 
Back
Top Bottom