Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Months &Years

    I'm trying to create an archive page of links to articles added to a database,
    and I would like to group these by months and years. So, for example my first
    page would look something like; April 2005 March 2005 February 2005 January
    2005 Decemeber 2004 etc etc Now, the code for displaying the pages thereafter
    is no problem (as I can obviously use the month and year as a variable to
    search the DB for the articles. What I am having a problem with however is how
    can I query the database to simply find out months and years that have entries
    , ideally omitting any months that don't. Many Thanks in advance Lee

    silstorm Guest

  2. Similar Questions and Discussions

    1. DateFormatter months language
      Hi all, how can you do to change the language the DateFormatter formats month names, when you specify a date format pattern such as "MMM". Even...
    2. 5803 will run one year or 6 months ?
      Hi all Vista-Folks , I am running Windows 6.0 Build 5308.winmain_idx01.060223-2145 ( official, activated and genuine and legal ? YES ! ) The...
    3. Getting List of Months & Years
      I'm trying to create an archive page of links to articles added to a database, and I would like to group these by months and years. So, for...
    4. Table listing of months
      I have the following snippet of code: <?php // contents of $monthlyarchivereverse is generated by a different // piece within a content managent...
    5. .Net: 3 years later...
      An interesting article on .Net and what has happened over the last 3 years. A good read. http://www.eweek.com/article2/0,,1184728,00.asp ...
  3. #2

    Default Re: Months &Years

    <cfquery name='GetMonths'> SELECT DISTINCT DATEPART(mm, dteArticle) AS month,
    DATEPART(yy, dteArticle) AS year FROM tblArticles </cfquery> The query would
    look something like that. When outputting the data you will need to group by
    month and perhaps year.

    KevinOtt Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139