When working with different time zones and different platforms
And to avoid date format issues 
And speed up date calculations
I convert all dates to YYYYMMDD
Then perform regular subtraction to get the date difference
So     20100330 – 20100310 = 20 days
And  20110530 – 20100310 = 10220 that is (1 year , 2 months , 20 days)


                                   case 1         case 2         case 3
date 1                     20100309    20100310    20100310
date 2                     20100320    20100320    20100330
= date 2 - date 1          11                  10                 20





________________________________
From: Les Mizzell <[email protected]>
To: cf-talk <[email protected]>
Sent: Wed, March 3, 2010 6:39:02 AM
Subject: Re: date calculations driving me batty!!


> <cfset req.daysAway = #DateDiff("D",req.departdate,req.returndate)#+1 >

OK - THIS works


<cfset req.hours = #DateDiff("h",req.departdate,req.returndate)#+25)>
<cfset req.daysAway = int(req.hours/24)>


__________ Information from ESET NOD32 Antivirus, version of virus signature 
database 4910 (20100302) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331293
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to