Ta
Amazingly I did work this one out myself, BUT, now my client has moved the goalposts...
I have produced a report that pulls info from a database - and two dates. He now wants to calculate the dateDiff between these two dates, for every record in the database (these have to be working days) and then divide the result by a number (actually the number of pumps in the queryset, which I already have due to a Recordcount)
I can create the following for on date diff:
- <cfset dtFrom = #CreateODBCDate(dateFormat(form.Pump_FromDate, 'dd/mm/yyyy'))# />
-
<cfset dtTo = #CreateODBCDate(dateFormat(form.Pump_ToDate, 'dd/mm/yyyy'))# />
-
<cfset dtDiff = (dtTo - dtFrom) />
-
<cfset ctDays = DateDiff ("d", dtFrom, dtTo)>
Can I:
- use this with the fields from my database that hold the two dates
- loop over the query to retrieve all the days as a total
- and ensure that it only counts working dates?
It's a big ask so any help would be appreciated!
thanks
Neil