12 Month increment

Posted on 2007-07-25
Last Modified: 2013-12-24

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,

Question by:brihol44
    LVL 39

    Expert Comment


    <!---- 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 --->


    Author Comment

    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!


     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.
    LVL 39

    Accepted Solution


     The error was caused by a missing ending )
                                                                     ^^ ) 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)>  


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
    The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: : Go t…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now