I'm looping over a span of dates and counting how many rental pieces are out
on each day.  Here's what my code looks like.

 

<Cfset startdate = createODBCDate('8/1/2003')>

<cfset enddate = createODBCDate('8/15/2003')>

 

<cfloop index="d" from="#startdate#" to="#enddate#" step="1">

 

            <cfquery name="countReserved" datasource="#datasource#">

                        Select Count (radios) as daycount

                                    from reservedTable

                                    where (StartDate <= #d#) 

                                    AND (ReturnDate >= #d#) 

                                    AND (radio_id = #form.inv_id#)

            </cfquery>

 

</cfloop>

 

I hardcoded the dates here for ease of explanation.  The problem is when I
run this code it returns the numbers for a datespan of  8/3/2003 -
8/17/2003.  It's seems to be adding on two days.  If I display the output by
placing this code within the loop

 

<cfoutput>

<tr>

            <td>#d#</td>    

            <td>#DateFormat(d, "mm/dd/yyyy")#</td>

            <td>#getreserved.daycount#</td>

</tr>

</cfoutput>

 

the formatted dates show the correct range but the counts are off by two
days.  It will show a date of 08/01/2003 and give me the count total for
08/03/2003.

 

What am I missing here?




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to