我正在使用Classic ASP编写注册表单,并希望关闭注册。我在变量“closingdate”中声明了结束日期,并且有另一个变量获取当前日期。
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
现在给我的结果是“注册仍然开放”,尽管我将截止日期设定为一年前的日期。我在这里遗漏了什么吗?
答案 0 :(得分:1)
首先尝试将字符串转换为日期:
if (currentdate > cdate(closingdate)) then
response.write("Registrations are closed")
else
response.write("Registrations are still open")
end if