<CFSET Now = Now()>
<CFSET dowToday = DayOfWeek(Now)>
<CFSWITCH _expression_="#dowToday#">
<!--- Sunday --->
<CFCASE value="1"><cfset enddate = #DateAdd("d", 5, now)#></CFCASE>
<!--- Monday--->
<CFCASE value="2"><cfset enddate = #DateAdd("d", 5, now)#></CFCASE>
<!--- Tuesday--->
<CFCASE value="3"><cfset enddate = #DateAdd("d", 6, now)#></CFCASE>
<!--- Wednesday--->
<CFCASE value="4"><cfset enddate = #DateAdd("d", 6, now)#></CFCASE>
<!--- Thursday--->
<CFCASE value="5"><cfset enddate = #DateAdd("d", 6, now)#></CFCASE>
<!--- Friday--->
<CFCASE value="6"><cfset enddate = #DateAdd("d", 6, now)#></CFCASE>
<!--- Saturday--->
<CFCASE value="7"><cfset enddate = #DateAdd("d", 6, now)#></CFCASE>
</CFSWITCH>
Kinda ugly but it should work. This is untested code so you might have to tweak the number of days to add to get it working right.
Cheers,
Jeff Garza
----- Original Message -----
From: Les Mizzell
To: CF-Talk
Sent: Wednesday, May 12, 2004 12:50 PM
Subject: Next "X" days - but SKIP the weekend....
Afternoon,
Can't quite seem to get my head around this.
I need to show an event list on a site that always list today and the
next 4 days. But....if any of those days = weekend - it has to SKIP
those and move on..
So
Thursday Listing
Friday Listing
Monday Listing
Tuesday Listing
Wednesday Listing
No problem doing this and *including* the weekend dates. Something like:
<cfset now = Now()>
<cfset enddate = #DateAdd("d", 5, now)#>
Then: show everything equal or less than #enddate# and equal or greater
than today....
....but I'm not sure how to go about skipping dates that fall on
Saturday or Sunday.
Ideas?
--
Les Mizzell
---------------------------------------
Do geeks die when exposed to sunlight?
---------------------------------------
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

