Pulling my hair again ...
I need to calculate the difference between two dates in days. I'm doing it:
<cfset d = DateDiff("d", Dateformat( active_apps.app_base_coupon_start, "dd.mm.yyyy"), Dateformat( variables.useDate, "dd.mm.yyyy") )>
With active_apps.app_base_coupon_start = active_apps.app_base_coupon_start and variables.useDate = today = 02.10.2012 .
I reset both values, they are fine. However, dateDiff returns -168 when I searched (4 days in July, August 31, September 30 in September, October 2) 67 days.
Question:
Can someone stop me from losing my remaining hair and tell me what I'm doing wrong here, or if there is an easier way to get the difference in days?
EDIT:
Ok, it also works as follows:
<cfif DateAdd("d", active_apps.app_grace_time, Dateformat( active_apps.app_base_coupon_start, "dd.mm.yyyy") ) GT now()> <cfdump output="e:\s\page\t\dump.txt" label="catch" var="YUP"> <cfelse> <cfdump output="e:\s\page\t\dump.txt" label="catch" var="NOPE"> </cfif>
but I would still like to know why dateDiff returns weird values.
source share