CF-Talk,

I am messing around trying to output the days of a given year. Using
CFLOOP the results are displayed in a second or two:

<cfset year=2004>
<cfloop from="1" to="12" index="month">
        <cfloop from="1" to="#daysinmonth(createdate(year,month,1))#" index="day">
                <cfoutput>#createdate(year,month,day)#</cfoutput><br>
        </cfloop>
</cfloop>

However, using what appears to be the equivalent in CFSCRIPT times out
despite a generous ?requesttimeout=500:

<cfscript>
        year=2004;
        for(month=1; month lte 12; month+1){
                for(day=1; day lte daysinmonth(createdate(year,month,1)); day+1){
                        writeoutput(createdate(year,month,day)&"<br>");
                }
        }
</cfscript>

I am assuming that I have made a stupid mistake, but I can't see
it--why are the nested 'for' loops performing so poorly?

CF5, if it matters.

~ Ubqtous ~
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to