How can I compare two dates in vbscript/ASP?

poo picture poo · Feb 24, 2010 · Viewed 55.3k times · Source

Using ASP classic, I need to somehow compare two dates with each other. How can I do this?

Answer

Mikos picture Mikos · Feb 24, 2010
Date1 = #rs["date"]#
Date2 = #12/1/2009#


If DateDiff("d", Date1, Date2) > 1 Then
    response.write "This date is before 12/1/2009"
Else
    response.write "This date is after 12/1/2009"
End If

HTH