I have a cfmail script that sends a daily summary of orders. It basically grabs all of the orders from the db, uses DateFormat(Now() and then uses the query to generate the rport. The cf scheduler send the page daily.

Now I need to send a report on a weekly basis. I started by saving a new copy of the cfmail file. now I need to generate my date range. It needs to go from today and subtract 7 days. So we want to show all orders from the previous Friday to through Thursday night.

My query looks like this: where a.OrderedDate = '#DateFormat(Now(), "yyyy-mm-dd")#' can someone give me an example of what my date range would look like?

thanks!

In case anyone else runs into this issue, here is the solution that worked for me:

<cfset startDate = Now() - 7> 
<cfset endDate = Now()>
where a.OrderedDate >= #CreateODBCDate(startDate)# and a.OrderedDate <= #CreateODBCDate(endDate)#
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.