You will need to build into it some kludge then that if the month has
21 days, calculate it that way and so on.

I don't think ColdFusion has a "Last day of the month" function. I may
be incorrect though. I still haven't had my morning coffee.

On Thu, Apr 2, 2009 at 8:30 AM, Bert Dawson <[email protected]> wrote:
>
> Or you could start with the first, add a month, then take away a day:
>
> <cfset date1 = CreateDate(2008, 12, 1)><!--- best to create a date object
> than using a string... --->
> <cfoutput>
>    <cfloop from=1 to=6 index=i>
>        <cfset date2 = dateAdd('d', -1, dateAdd('m', i, date1))>
>        #dateFormat(date2, 'mm/dd/yyyy')#<br />
>    </cfloop>
> </cfoutput>
>
> Bert
>
>
> On Thu, Apr 2, 2009 at 10:15 AM, Francois Levesque <[email protected]>wrote:
>
>>
>> That's odd, but not unexpected. Since you're starting on the 30th, it's
>> adding a month to that and reduces when the month doesn't have 30 days in
>> it. It's not taking the initiative of thinking you want the last day of the
>> month.
>>
>> Maybe this would work?
>>
>>       <cfset date1 = '11/01/2008' />
>>        <cfoutput>
>>               <cfloop from=1  to=6 index = i>
>>                       <cfset date2 = dateAdd('m', i, date1) />
>>                        #dateFormat(date2,'mm')#/#daysInMonth( date2
>> )#/#dateFormat(date2,'yyyy')#                <br />
>>               </cfloop>
>>       </cfoutput>
>>
>> Francois Levesque
>> http://blog.critical-web.com/
>>
>>
>> On Thu, Apr 2, 2009 at 11:05 AM, Tony <[email protected]> wrote:
>>
>> >
>> >        <cfset date1 = '11/30/2008' />
>> >        <cfoutput>
>> >                <cfloop from=1  to=6 index = i>
>> >                        <cfset date2 = dateAdd('m', i, date1) />
>> >                        #dateFormat(date2,'mm/dd/yyyy')#
>>  <br
>> > />
>> >                </cfloop>
>> >        </cfoutput>
>> >
>> > very simple code.  however, its behaving like i dont want it to.
>> > id rather see it increment by a MONTH, not same day next month.
>> >
>> > the output of that code above is:
>> >
>> > 12/30/2008
>> > 01/30/2009
>> > 02/28/2009
>> > 03/30/2009
>> > 04/30/2009
>> > 05/30/2009
>> >
>> > and i would rather it be....
>> >
>> > 12/31/2008
>> > 1/31/2009
>> > 2/28/2009
>> > 3/31/2009
>> > 4/30/2009
>> > 5/31/2009
>> >
>> > what should i be using? this is weird... i supply "m" to get month
>> > increment, but
>> > no dice...
>> >
>> > thanks
>> > tw
>> >
>> >
>>
>>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321228
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to