James Smith wrote:
> Is there an easy way to tell how many working days there are in a month
> (Monday - Friday)?
<cffunction name="workingDaysInMonth" returnType="numeric" output="no">
<cfargument name="dt" type="date" required="yes">
<cfset var retVal = 0>
<cfset var theDay = "">
<cfset var I = 0>
<cfloop from="1" to="#DaysInMonth(dt)#" INDEX="I" STEP="1">
<cfset theDay = DayOfWeek(CreateDate(Year(dt),Month(dt),I))>
<cfif ListContains("2,3,4,5,6", theDay)>
<cfset retVal = retVal + 1>
</cfif>
</cfloop>
<cfreturn retVal>
</cffunction>
<cfoutput>Working days in current month:
#workingDaysInMonth(Now())#</cfoutput>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186432
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