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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date comparisons failing??

Status
Not open for further replies.

ApexSys

Programmer
Jan 10, 2001
15
US
I've got a problem comparing dates. I've got a form date being passed that evaluates to: 02/50/2001 9:47AM and a database date I'm looking up that is: 01/29/2001 12:38PM

So I want to compare these and display the later of the two.

The key code here is:
<cfif 'form.StatusTimeEdit' lte 'Status_TimeEdit'>
...then print the following to screen...
Failed!
02/29/2001 9:47PM is LTE 01/29/2001 12:38PM

<cfelse>
Success!
... the converse ...

As you can see above the form.date is later that the DB.date yet my comparison fails to recognize this. Is this due to the dates not being in the proper ODBC dateformat when compared? Or is my understanding of the GT &amp; LT date comparison just way off?

Thanks,
-=-=-=-=-=-=-=-=-=-=-=-=-=-
Apex Systems Consulting
e-Solutions for Small Business
 
You'll want to use the datecompare() function to compare dates. CF has no way to know that your variables contain dates as they are simply string variables.

<cfif datecompare(form.StatusTimeEdit,Status_TimeEdit) is -1>

GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top