Thank You Charlie! That works perfect. -e
-----Original Message----- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 14, 2006 12:10 PM To: CF-Talk Subject: Re: Recurring Events ? ex. 3rd thursday not thoroughly tested... <cfscript> function getEveryNthDay(dow,nth,yy) { /** * returns an array of dates containing every (nth) day of week for a given year * * @param dow the day of the week to return (integer...sunday = 1 / saturday = 7) * @param nth every (nth) day of the week (integer...1-5 are valid argument values) * @param yy the year to check * * @return an array of dates. * @author Charlie Griefer ([EMAIL PROTECTED]) * @version 1.0, February 14, 2006 */ var containerArray = arrayNew(1); var mm = ""; var dd = ""; var startDate = ""; var dateFound = 0; if (val(dow) LT 1 OR val(dow) GT 7) { return false; } for (mm=1; mm LTE 12; mm=mm+1) { dateFound = 0; for (dd=1; dd LTE daysInMonth(createDate(yy, mm, 1)); dd=dd+1) { startDate = createDate(yy, mm, dd); if (dayOfWeek(startDate) EQ dow) { dateFound = dateFound + 1; if (dateFound EQ nth) { arrayAppend(containerArray, startDate); } } } } return containerArray; } </cfscript> 3rd friday of each month (tuesday = 6): <br /><br /> <cfdump var="#getEveryNthDay(6, 3, 2006)#"> On 2/14/06, Emmet McGovern <[EMAIL PROTECTED]> wrote: > I can't seem to wrap my head around this. Does anyone know how you loop > through every third Thursday of the month in a year or every second Tuesday > and so on? > > Emmet > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232223 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=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54