Looks good... but my opinion might be biased. =] Kevin
-----Original Message----- From: Emmet McGovern [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 19, 2005 9:05 AM To: CF-Talk Subject: Easier way to loop though weekends? I'm writing a script to insert groups of weekend dates in a db. I've managed to do it but I'm curious if I've written the most efficient way. The dates will be entered by a form and I needed to compensate for the user entering a start date that wasn't a weekend date, otherwise the first conditional loop would fail. Check my code below. I've set the recurdate and number of weekends manually for examples sake. I adjust at the beginning and end to ensure the next date set in the loop will be a weekend. For some reason it just seems sloppy. Thanks, emmet <cfoutput> <CFSET RecurDate = #CreateDate(2005, 4, 19)#> <cfloop index="RecurNum" FROM="1" TO="5"> <cfset adjust = evaluate(DayOfWeek(RECURDATE) - 7)> <cfif adjust lt 0> <cfset adjust = evaluate(-adjust)> </cfif> <CFSET RecurDate = #DateAdd('d', adjust, RecurDate)#> <cfloop condition="DayOfWeek(RECURDATE) eq 1 OR DayOfWeek(RECURDATE) EQ 7"> #recurdate#<br> <CFSET RecurDate = #DateAdd('d', 1, RecurDate)#> </cfloop> <cfset adjust = evaluate(DayOfWeek(RECURDATE) - 7)> <cfif adjust lt 0> <cfset adjust = evaluate(-adjust)> </cfif> <CFSET RecurDate = #DateAdd('d', adjust, RecurDate)#> <br><br> </cfloop> </cfoutput> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:203521 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

