Use day of week to determine the ordinal for the current day, determine  
the difference between that number and one and subtract it from todays  
date. Find the difference between that number and 7 and add it to  
todays date.

Something like the following should get it, but you might want to check  
the code. There may be a better way to do it, but this is how i have  
done it in the past. I haven't looked to see if there is a UDF  
available at cflibs.org though, if not I might throw one together.

<cfset weekStart = dateAdd("d",((#DayOfWeek(now())# - 1) * -1),now())>
<cfset weekEnd = dateAdd("d",(7 - #DayOfWeek(now())#),now())>

Andrew Golden

On Jan 6, 2005, at 4:05 PM, E C list wrote:

> Can someone remind me of the most efficient way to
> determine the first and last day of "this week" using
> ColdFusion 5?  I want to make a report option which
> shows items that occured during "this week, this
> month, this quarter..." but this week is giving me
> trouble.  I can do it, but not very effiently, IMHO.
>
> Thanks !
>
>
>
>               
> __________________________________
> Do you Yahoo!?
> Meet the all-new My Yahoo! - Try it today!
> http://my.yahoo.com
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189585
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to