I am trying to test whether the enddate is less than the startdate. I am using the date compare function and it is not returning what I expect. Here is the code that I am using:
Here is the output from this code:
StartDate={ts '2002-01-01 00:00:00'}
EndDate={ts '2003-07-05 00:00:00'}
DateCompare=1
from the documentation
DateCompare performs a full date/time comparison of two dates. Returns:
-1 if date1 is less than date2
0 if date1 is equal to date2
1 if date1 is greater than date2
to me it looks as if StartDate < EndDate and that is should return -1
Can someone shed some light on this??
Code:
<cfset StartDate=CreateDate (form.selStartDateYear,form.selStartDateMonth,form.selStartDateDay)>
<cfset EndDate=CreateDate (form.selEndDateYear,form.selEndDateMonth,form.selEndDateDay)>
<cfoutput>StartDate=#StartDate#<br>EndDate=#EndDate#<br>DateCompare=#DateCompare(EndDate,StartDate)#</cfoutput>
Here is the output from this code:
StartDate={ts '2002-01-01 00:00:00'}
EndDate={ts '2003-07-05 00:00:00'}
DateCompare=1
from the documentation
DateCompare performs a full date/time comparison of two dates. Returns:
-1 if date1 is less than date2
0 if date1 is equal to date2
1 if date1 is greater than date2
to me it looks as if StartDate < EndDate and that is should return -1
Can someone shed some light on this??