문제

In my classic asp code, I want to compare two dates. I have this code:

response.Write(date())
response.Write("<br/>")
response.Write(Deadline)
response.Write("<br/>")
response.Write(date() > Deadline)

And it outputs:

6/18/2013
12/17/2002
False

It should be true though. Also the value of Deadline is a value passed in from a url parameter, so its a regular string format, not sure if that matters.

Does anyone know what is wrong here?

Thanks

도움이 되었습니까?

해결책

Haven't done ASP or VBScript in awhile, but if I remember, you can convert a string to a date using the CDate function. So:

response.Write(date() > CDate(Deadline))

should get you what you're looking for.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top