Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which date is greater?

Status
Not open for further replies.

cfash

Programmer
Nov 22, 2000
8
US
I am having a problem figuring out how to get this to work.
date1 = 1/1/90
dateMin = 4/3/90
dateMax = 2/16/01

if (date1 < dateMin) then
Error 1
elseif (date1 > dateMax) then
Error 2
end if

This should be performing Error 1, but it is performing Error 2. Does anyone have any suggestions as to what the problem might be?

Chris
 
At aspsamples.com there is section where you can paste ASP code into a textarea, then run it. I did this with the code above, altering it slightly:
<%@ language=vbscript%>
<%
date1 = 1/1/90
dateMin = 4/3/90
dateMax = 2/16/01

if (date1 < dateMin) then
response.write &quot;less&quot;
elseif (date1 > dateMax) then
response.write &quot;more&quot;
end if
%>
This code executed propery, so we know the logic is correct.
For fun I would make your years 4 digits.
Post back if you find a solution.

MikeT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top