datediff() is what you are looking for.
--Ben Doom
Andrew Whone wrote:
> I retrieve a bunch of dynamic DateFroms and DateTos that a user has input
> into a form.
> <!--- Loop through the dateField IDs to get the Dates ranges--->
> <cfloop list="#form.DatefieldID#" index="id">
> <!--- Get the dates--->
> <cfset DateFrom = form["dateFrom_" & id]>
> <cfset DateTo = form["dateTo_" & id]>
> <!--- Format the dates--->
> <CFSET DateFrom1 = #DateFormat(DateFrom, "yyyy-mm-dd")#>
> <CFSET DateTo1 = #DateFormat(DateTo, "yyyy-mm-dd")#>
> <!--- Get the number of days in each period--->
> <cfset DateDifference = DateDiff("d", "#DateFrom1#", "#DateTo1#")+1>
> </cfloop>
> I want to know the DateFrom of the first period that is more than 4 days and
> I want to find out if each date range is separated by at least one day. I
> have ensured that the date ranges are in chronological order and the DateFrom
> is before the DateTo.
> <!--- Get the DateFrom of the first period that is more than 4 days?--->
> <cfif #DateDifference# GT 4>
> </cfif>
> Any clues would be much appreciated!
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion is delivering applications solutions at at top companies
around the world in government. Find out how and where now
http://www.adobe.com/cfusion/showcase/index.cfm?event=finder&productID=1522&loc=en_us
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:291840
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4