Skip to main content
Inspiring
April 18, 2006
Question

Compare two dates with VBScript & ASP

  • April 18, 2006
  • 2 replies
  • 2324 views
I am trying to compare two dates, held with in two seperate variables in VB
Script/ASP
and not having much luck, the code I am using is listed below, and no matter
what dates I put in the variable I get the same answer - past

varYearNow = year(date)
varFormYear = Request.Form("ExpYear")

If varYearNow > varFormYear
varExpiryDate = "past"
Else
varExpiryDate = "future!"
End If

Any ideas or tutorials would be welcomed.
Thanks in advance


This topic has been closed for replies.

2 replies

Inspiring
April 19, 2006
Use CLng instead of CInt as I have found CInt to be quite unreliable in this
sort of comparison. Something to do with the way it is converted - it isn't
a 'True' Int. So, definately use CLng.

Pat.


"Julian Roberts" <nospam@charon.co.uk> wrote in message
news:e23r4i$i18$1@forums.macromedia.com...
> Try
>
> varFormYear = Cint(Request.Form("ExpYear"))
>
> --
> Jules
> http://www.charon.co.uk/charoncart
> Charon Cart 3
> Shopping Cart Extension for Dreamweaver MX/MX 2004
>
>
>


Inspiring
April 18, 2006
Try

varFormYear = Cint(Request.Form("ExpYear"))

--
Jules
http://www.charon.co.uk/charoncart
Charon Cart 3
Shopping Cart Extension for Dreamweaver MX/MX 2004