[tt]<!--- loop through all 12 months --->
<CFLOOP INDEX="m" FROM="1" TO="12">
<!--- thedate starts as the 1st of the month --->
<CFSET thedate = CreateDate(myyear,m,1)>
<!--- loop over current and next six days --->
<CFLOOP INDEX="wd" FROM="0" TO="6">
<CFIF DayOfWeek(thedate) IS myweekday>
<CFSET dayofmonth=Day(thedate)>
<CFBREAK>
</CFIF>
<CFSET thedate=DateAdd("d",1,thedate)>
</CFLOOP>
<!--- move to the nth of the month --->
<CFSET n = Left(mynth,1) * 7 - 7>
<CFSET nthdate = CreateDate(myyear,m,dayofmonth)>
<CFSET nthdate = DateAdd("d",n,nthdate)>
<!--- if nth was 5th, it is possible that
we have gone past the end of the month --->
<CFIF Month(nthdate) EQ m>
<CFOUTPUT>
<br />#DateFormat(nthdate,"mmm dd"#
</CFOUTPUT>
<CFELSE>
<CFOUTPUT>
<br />#DateFormat(thedate,"mmm"# has none
</CFOUTPUT>
</CFIF>
</CFLOOP>[/tt]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.