I'm doing a calendar app at the moment, I needed to do the same and I came
up with...
<cfset startDate = DateAdd("d", 1 - DayOfWeek(Now()) + URL.dayOffset,
Now())>
... but you may only need...
<cfset startDate = DateAdd("d", 1 - DayOfWeek(Now()), Now())>
... haven't tested that second line as I need the offset in my version.
Ade
-----Original Message-----
From: Andrew Golden [mailto:[EMAIL PROTECTED]
Sent: 06 January 2005 22:21
To: CF-Talk
Subject: Re: This Week
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 !
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.9 - Release Date: 06/01/2005
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:189724
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