Reputation: 373
I'm writing in Classic ASP for a registration form, and would like to close the registration. I declared the closing date in the variable "closingdate", and have another variable which gets the current date.
dim closingdate : closingdate = "5/17/2014"
response.write("Closing date: " & closingdate & "<br>")
dim currentdate : currentdate = Date
response.write(currentdate)
response.write("<br>")
if (currentdate > closingdate) then
response.write("Registrations are closed")
else
response.write("Registrations are still open")
end if
The results given to me right now is the "Registrations are still open", despite me setting the closing date as a date that's a year before. Have I left out something here?
Upvotes: 0
Views: 1025
Reputation: 1225
try casting your string into a date first:
if (currentdate > cdate(closingdate)) then
response.write("Registrations are closed")
else
response.write("Registrations are still open")
end if
Upvotes: 0