Heh... how about "because I said so"? :P Actually ... to simplify...
the value of dayOfWeek(now()) will vary from one day to the next -- it's 1 on sunday, 2 on monday, etc... and this has a lot to do with why people find it complicated to get the first day of the week from ColdFusion, because the first day of the week will never change. This week, the first day of the week is Sunday, April 10 (in the US). For time and all eternity, the first day of this week will be Sunday, April 10, but the value of dayOfWeek(now()) today is 2 and tomorrow it will be 3. So rather than shooting at a "moving target" you have a stationary target and are shooting at it from a moving platform. That being the case, in order to hit the target, you have to "adjust for movement" -- and that's why you use dayOfWeek(now()) to adjust today's date to get the first day of the week -- because dayOfWeek(now())-1 will always return the number of days (the difference) between today (now()) and the first day of the week (sunday). Is that more digestible? :) Technically you can't even use now() if you want to make it i18n because you have to use universal time coordinate (UTC) dates if the application will be i18n, to guarantee that the times and dates are accurate in all locations even if the server is moved (I.e. your server is hosted in Miami and then you move it to Salt Lake, suddenly now() returns local time in Salt Lake which is 2-3 hrs behind Miami, and if you input dates with now() you now have a discrepancy between records entered while the server was hosted in Florida and records entered while it's hosted in Utah). I make you sick don't I? :P > .... :o) otay... Maybe it'll make more sense that way, > when I try to wrap my thick head around it... > Rick >> -----Original Message----- >> From: S.Isaac Dealey [mailto:[EMAIL PROTECTED] >> Sent: Monday, April 11, 2005 3:10 PM >> To: CF-Talk >> Subject: RE: Last Week... >> >> >> Argh! I am not having a good day today am I? ... >> >> In my previous message, just imagine that every time I >> said "monday" I >> was saying "sunday" and you'll be fine. :) >> >> > Not quite sure I grasp that, Isaac...would that only >> > work >> > if it were run on the second day of the week? >> >> > Rick >> >> >> -----Original Message----- >> >> From: S.Isaac Dealey [mailto:[EMAIL PROTECTED] >> >> Sent: Monday, April 11, 2005 2:04 PM >> >> To: CF-Talk >> >> Subject: Re: Last Week... >> >> >> >> >> >> > Could anyone tell me the most efficient way to get >> >> > the >> >> > start and end dates of the past full week? >> >> >> >> > Thanks! >> >> >> >> >> >> <cfset firstdayofthisweek = >> >> dateadd("d",dayofweek(now())-1,now())> >> >> >> >> From there you can add -7 days to get the first day of >> >> last week or -1 >> >> day to get the last day of last week. s. isaac dealey 954.522.6080 new epoch : isn't it time for a change? add features without fixtures with the onTap open source framework http://macromedia.breezecentral.com/p49777853/ http://www.sys-con.com/author/?id=4806 http://www.fusiontap.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:202264 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=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

