12 Month increment

Hello,

If I wanted to display the next 12 months in rows (<td></td>). How would I do this with Coldfusion?

So If this month was july I wanted to display this month and the next 11 months and year how would attempt to do this? Of course I would like the months and year to be separated into <td></td>'s as well.

Thank you,

Brian
brihol44Asked:
Who is Participating?
 
gdemariaConnect With a Mentor Commented:

 The error was caused by a missing ending )
    createDate(month(now()),1,year(now())>  
                                                                 ^^ ) needed


 But sorry, looks like I remember createDate() wrong.  Here's the correct order of the parameters.

<cfset variables.theDate = createDate(year(now()), month(now()), 1)>  

0
 
gdemariaCommented:

<!---- assign theDate to be the first date of the current month --->
<cfset variables.theDate = createDate(month(now()),1,year(now())>  

<cfloop index="kk" from="1" to="12">  <!---- show 12 months --->
   <td>#dateFormat(DateAdd("m",kk-1,variables.theDate),"mmm-yy")#</td>
</cfloop>

0
 
brihol44Author Commented:
Thank you for responding however I get an error. I've been trying everything I can think of but something is not quite right. Thank you!

Brian

 Invalid CFML construct found on line 17 at column 65.
ColdFusion was looking at the following text:

>

The CFML compiler was processing:

    * an expression beginning with "createDate", on line 17, column 28.This message is usually caused by a problem in the expressions structure.
    * a cfset tag beginning on line 17, column 2.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.