David Williamson
asked on
Datecompare compares date AND time - how to compare just date?
I am using datecompare in this manner:
#DateCompare(now(),getDD.D ueDate)#
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?
#DateCompare(now(),getDD.D
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This seems to do exactly what I'm looking for:
#DateCompare(CreateDate(ye ar(now()), month(now( )),day(now ())), getFU.FUDueDate)#
#DateCompare(CreateDate(ye
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 :-)
You can also do it in this manner :
<cfset Date1 = DateFormat(now(),'yyyy/mm/
<cfset Date2 = DateFormat(getDD.DueDate,'
#DateCompare(Date1,Date2)#
Regards!
eNTRANCE2002 :-)
ASKER
I tried this
#DateCompare(DateFormat(no w(), '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.
#DateCompare(DateFormat(no
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.
ASKER
sorry for the delay, folks. haven't been at work for a bit...
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