There isn't an quick and easy solution, although a few straight forward ones.

Everyone is going to suggest you do a DateDiff on each date part you want to 
handle, but after quickly glancing at cflib.org, think that a better solution 
might be the following.

Use DateDiff to get the difference in seconds and then use the formatTimespan 
function from cflib.org.

http://www.cflib.org/udf.cfm?ID=1637

Of course, you can also roll your own function to do the same thing, which if 
you are going to do this more than once, you definitely want to encapsulate 
this functionality to reuse it.

<cfset aDate = "07/04/2007">
<cfset bDate = "12/01/2007">

<cfset sDif = DateDiff("s", aDate, bDate)>
<cfset ts = CreateTimeSpan(0,0,0,sDif)>
<cfoutput>#formatTimeSpan(ts,"y year{s}, m month{s}, d day{s}, n 
minutes")#</cfoutput>

OUTPUT:
0 years, 4 months, 29 days, 60 minutes


> I am trying to figuring how to determine the year, months and days 
> from a date. Like from 1/1/2007 to 2/9/2008 it is 1 year 1 month and 8 
> days. I am trying to figure out how to do that programmatically.
> 
> I have been trying to do it with datediff but I cannot figure out how.
> 
> 
> Any help would be great.
> 
> Thanks! 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298679
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to