Link to home
Start Free TrialLog in
Avatar of onaled777
onaled777Flag for United States of America

asked on

Understanding the DateDiff function

Does anyone know why the code below would return 5 or 6 for its value when LastContacted is 10/21/2009. I only want it to return 5 because there are 5 days in between today and that date.  

Any direction you can provide would be appreciated.
<cfset displaydate = dateDiff('d', LastContactDate, Now()) + 1 />

Open in new window

Avatar of onaled777
onaled777
Flag of United States of America image

ASKER

ok...I was made to understand that lastContactDate may be a timestamp so it tends to depend on the time the query is run. Exactly how do i get around this?
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

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
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
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 arun80_inin
arun80_inin

check the timestamp in the server. Sine Now() function return the current date from coldfusion server, the resule might have changed due to difference between server timestamp and your system timestamp.