Getting the month by Number

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

  1. #1

    Default Getting the month by Number

    Hi Folks,

    I'm trying to create an archive system, and want to be able to display
    articles according to the month. The system I have setup at the moment appears
    to work, apart from one part. At the top of the index for that month, I was to
    have the text 'Articles added in (month), (year).

    Now the year isn't a problem because I'm obviously passing that as the
    displayed value anyway. However, I'm passing the month as a number - ie 7 for
    July. The URL works like this = [url]www.myserver.com/archive.cfm/month/7/year/2005[/url]
    (I'm using a search engine safe url system).

    So, I need a way of converting the month number to the month name. I've tried
    a few different methods, but they all seem to bring back January for some
    reason, so I'm guessing I'm not doing it correctly.

    Any advice would be appreciated!

    silstorm Guest

  2. Similar Questions and Discussions

    1. change month number to name
      I have a setting for a calendar that defaults the calender to the current month <cfset cal_month=dateformat(now(), "m")> This can be changed by the...
    2. int Number to text Number Function / UDF ?
      Is there a function that converts e.g. 3 to Three? Probably not but I just thought I'd ask.
    3. sort from the smallest number to the highest number
      Hi Just say I want to sort the row by using the fifth column data as reference from the smallest the largest number, if using sort, It will give...
    4. Can I display a month from a number in a csv file?
      Greetings from a second day newbie to php. I think I have figured out a way to explode a field in a csv file (like 11-08-03) and implode it as...
    5. to convert a month to previous month
      How to convert a month to previous month in a very easy way? For example, I have AUGUST, but I want JULY to return. Thanks. *** Sent via...
  3. #2

    Default Re: Getting the month by Number

    > I'm trying to create an archive system, and want to be able to display
    > articles according to the month. The system I have setup at the moment appears
    > to work, apart from one part. At the top of the index for that month, I was to
    > have the text 'Articles added in (month), (year).
    ..../....
    > So, I need a way of converting the month number to the month name. I've tried
    > a few different methods, but they all seem to bring back January for some
    > reason, so I'm guessing I'm not doing it correctly.
    >
    >
    Maybe something like :

    <cfset YourDate = CreateDate(#Year#, #month#, 1)>

    and after
    Articles added in #DateFormat(YourDate,"mmmm")#, (#year#)

    JB


    Jibé Guest

  4. #3

    Default Re: Getting the month by Number

    That worked a treat - many many thanks!
    silstorm 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