Link to home
Start Free TrialLog in
Avatar of David Williamson
David WilliamsonFlag for United States of America

asked on

Datecompare compares date AND time - how to compare just date?

I am using datecompare in this manner:

#DateCompare(now(),getDD.DueDate)#

However, I am not getting the results I'm looking for because the date AND time of now() of being compared to just a date and zero hours.  I just want to compare date for date.  How can I fix this?
ASKER CERTIFIED SOLUTION
Avatar of danrosenthal
danrosenthal

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mrichmon
mrichmon

If you just want the effects of datecompare with date only then use tim_cs's solution.

If you want to be able to fine-control the comparison use datediff.

Here is a page that explains the first parameter to datediff for the different comparisons

http://livedocs.macromedia.com/coldfusion/6/CFML_Reference/functions-pt158.htm
Avatar of David Williamson

ASKER

This seems to do exactly what I'm looking for:

#DateCompare(CreateDate(year(now()),month(now()),day(now())), getFU.FUDueDate)#
Avatar of Renante Entera
Hello theamzngq!

You can also do it in this manner :

<cfset Date1 = DateFormat(now(),'yyyy/mm/dd')>
<cfset Date2 = DateFormat(getDD.DueDate,'yyyy/mm/dd')>

#DateCompare(Date1,Date2)#

Regards!
eNTRANCE2002 :-)

I tried this

#DateCompare(DateFormat(now(), 'MM/DD/YYYY'), getDD.DueDate)#

which is essentially what you have written, only broken up into variables, and it didn't work, which is why I went with the above.
What results did my example give you?  I tested it and it worked fine for me.
sorry for the delay, folks.  haven't been at work for a bit...