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 > </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
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics.
http://www.fusionauthority.com/signup.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4