Depends...  If you are looking at less than 31 days difference then you
can do it in the db. (only tried this in SQL Server).

Select cprAdultExp, getDate() as [now], day(getDate() - cprAdultExp) - 1
as dayDiff
>From table

You can get days, hours, minutes, seconds from this. Day is the only one
you have to -1 from.

In sql server they will all come back 1900-01-DD HH:MI:SS.xxx

Steve

-----Original Message-----
From: Adam Bourg [mailto:[email protected]] 
Sent: Friday, January 28, 2011 1:45 PM
To: cf-talk
Subject: Subtracting two dates


I'm trying to figure out how to subtract two dates and return the number
of days between then.

My dates are cprAdultExp, which is a database column, I typically write
it as: #dateformat(cprAdultExp,"mm/dd/yyyy")#

The other is Now()
Which I also format as: #dateformat(Now(),"mm/dd/yyyy")#

What's the easy way to do this? 





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341648
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to