<cfset startmonth="4">
<cfset startyear="2003">
<cfloop from="#startyear#" to="#dateformat(now(),"yyyy")#" index="y">
<cfif dateformat(now(),"yyyy") eq y>
<cfset endmonth = dateformat(now(),"mm")>
<cfelse>
<cfset endmonth = 12>
</cfif>
<cfloop from="#startmonth#" to="#endmonth#" index="i">
#dateformat('#i#/1/#y#',"mmmm yyyy")#<br />
</cfloop>
<cfset startmonth = 1>
</cfloop>
which is pretty similar to what's being suggested. I'll use a mixture
of all - thanks all!
jb.
On Mon, 9 Aug 2004 15:26:22 +0100, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> >> I want to programmatically create a consecutive list of months/dates
> >> starting from a certain month, eg
>
> Set your intial date, set your max date, loop round incrementing the
> month by one using dateAdd
>
> <cfscript>
> startDate = createDate(2003, 03, 01);
> endDate = now();
> thisDate = startDate;
>
> while (dateCompare(thisDate, endDate, "m") lt 1) {
> writeoutput(MonthAsString(Month(thisDate)) & " " &
> Year(thisDate) & "<br />");
> thisDate = dateAdd("m", 1, thisDate); //Increment month
> }
> </cfscript>
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

