Hi Susan:

Where you currently have:
<CFSET ThisDay = ThisDay + 1>
(which is right after the table cell that displays the date)...

Replace that with:
<cfif dayOfWeek(theDate) EQ 6><CFSET ThisDay = ThisDay + 3><cfelse><CFSET
ThisDay = ThisDay + 1></cfif>

Basically just says to increment the date by 1, unless the day of week is a
friday...in which case incremeent by 3 (skip sat and sun...go to mon)



charlie

-----Original Message-----
From: Susan Wohlgemuth [mailto:[EMAIL PROTECTED]
Sent: Friday, July 25, 2003 7:11 AM
To: CF-Talk
Subject: 5 day calendar help needed


Hi everyone -

I have a calendar application that works very well, except for my purposes I
need a 5 day calendar, instead of  7 day. I am new to Coldfusion and am
unable to figure out how to configure this to skip the weekend dates. I have
it so that it only shows Monday through Friday in 5 columns as the days of
the week, but it doesn't skip the Sat. & Sun. numbered dates.

I stripped down the code to just the essentials. Help would be appreciated.
Please keep it simple for this CF newbie.
Thanks
Susan


<html>
<!--- Set the month and year parameters to equal the current values if they
do not exist. --->
<CFPARAM name = "month" default = "#DatePart('m', Now())#">
<CFPARAM name = "year" default = "#DatePart('yyyy', Now())#">
<!--- Set the requested (or current) month/year date and determine the
number of days in the month. --->
<CFSET ThisMonthYear = CreateDate(year, month, '1')>
<CFSET Days = DaysInMonth(ThisMonthYear)>

<TABLE width="764" border = "1">
<!--- Display the day of week headers.   --->
<TR>
<CFLOOP from = "2" to = "6" index = "LoopDay">
<CFOUTPUT>
<TD width = "108" align = "center">#Left(DayOfWeekAsString(LoopDay),
10)#</TD>
</CFOUTPUT>
</CFLOOP>
</TR>
<!--- Set the ThisDay variable to 0.  This value will remain 0 until the day
of the week on which the --->
<!--- first day of the month falls on is reached. --->
<CFSET ThisDay = 0>
<!--- Loop through until the number of days in the month is reached.  --->
<CFLOOP condition = "ThisDay LTE Days">
<TR>
<!--- Loop through each day of the week. --->
<CFLOOP from = "2" to = "6" index = "LoopDay">
<!--- If ThisDay is still 0, check to see if the current day of the week in
the loop --->
<!--- matches the day of the week for the first day of the month. --->
<!--- If the values match, set ThisDay to 1. --->
<!--- Otherwise, the value will remain 0 until the correct day of the week
is found. --->
<CFIF ThisDay IS 0>
<CFIF DayOfWeek(ThisMonthYear) IS LoopDay>
<CFSET ThisDay = 1>
</CFIF>
</CFIF>
<!--- If the ThisDay value is still 0, or it is greater than the number of
days in the month, --->
<!--- display nothing in the column. --->
<!--- Otherwise, display the day of the month and increment the value. --->
<CFIF (ThisDay IS NOT 0) AND (ThisDay LTE Days) >
<cfset TheDate = CreateDate(year, month, ThisDay)>
<TD > <CFOUTPUT>#ThisDay#</CFOUTPUT> <BR></TD>
<CFSET ThisDay = ThisDay + 1>
<CFELSE>
<TD >&nbsp;</TD>
</CFIF>
</CFLOOP>
</TR>
</CFLOOP>
</TABLE>
</html>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to