Looks like this will break on a leap year, though.

Try 

calDays=DaysInYear(Now());

> -----Original Message-----
> From: Owens, Howard [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 28, 2003 4:54 PM
> To: CF-Talk
> Subject: RE: calculating date recurrence
> 
> 
> Matthew, thanks ... I modified what you showed me to the code 
> below, and it
> works perfectly.
> 
> <cfscript>
>       calDays = 365;
>       interval = form.TIME_INTERVAL;
>       numEvents = calDays \ interval;
> 
>       variables.myDate = ArrayNew(1);
>       variables.myDate[1] =  "#form.month#/#form.day#/#form.year#";
>                       
>               for(i=1; i LTE numEvents; i=i+1) {
>                       arrayAppend(variables.myDate, dateAdd('d', i *
> interval, variables.myDate[1]));
>               }
>               variables.recurrence_type = "Daily";
> </cfscript>
> 
> > -----Original Message-----
> > From:       Matthew Walker [SMTP:[EMAIL PROTECTED]
> > Sent:       Thursday, February 27, 2003 5:53 PM
> > To: CF-Talk
> > Subject:    RE: calculating date recurrence
> > 
> > What are you trying to do? Create an array of dates for 
> your recurring
> > event? How about this...?
> > 
> > <cfset showEventsnDaysInAdvance = 365>
> > <cfset interval = 7>
> > <cfset numberOfEventsToShow = showEventsnDaysInAdvance \ interval>
> > <cfset myDates = arrayNew(1)>
> > 
> > <cfloop from="1" to="#numberOfEventsToShow#" index="i">
> >     <cfset arrayAppend(myDates, dateAdd("d", i * interval, now()))>
> > </cfloop>
> > 
> > 
> > -----Original Message-----
> > From: Owens, Howard [mailto:[EMAIL PROTECTED] 
> > Sent: Friday, 28 February 2003 1:36 p.m.
> > To: CF-Talk
> > Subject: calculating date recurrence
> > 
> > OK, I'm working on building my own calendar application.
> > 
> > I'm trying to come up with a way of dealing with recurrence.
> > 
> > The first step is to calculate -- event occures every n 
> days apart, i.e.,
> > event occures every 3 days.
> > 
> > Here's one way I've tried so far (but this is like chewing 
> up all the
> > processor time)
> > 
> > variables.date = ArrayNew(1);
> > variables.date[1] =  "#form.month#/#form.day#/#form.year#";
> >     for(i=1; i LTE 30; i=i+1) {
> >     x=1;
> >             while (i  mod form.TIME_INTERVAL){
> >             variables.date[x] = DateAdd("d", 
> (form.TIME_INTERVAL-1)+x,
> > variables.date[1]);
> >             x=x+1;
> >     }
> >     }
> > 
> > Something else I tried, but it creates too many empty array 
> elements:
> > 
> > variables.date = ArrayNew(1);
> > variables.date[1] =  "#form.month#/#form.day#/#form.year#";
> >     for(i=1; i LTE 30; i=i+1) {
> >             if (i  mod TIME_INTERVAL){
> >                                      
> > }
> >             else {
> >                     variables.date[i] = DateAdd("d",
> > (TIME_INTERVAL-1)+i, variables.date[1]);    
> > }
> > }
> > 
> > I'm open to suggestions.
> > 
> > H.
> > 
> > 
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > Howard Owens
> > Internet Operations Coordinator
> > InsideVC.com/Ventura County Star
> > [EMAIL PROTECTED]
> > AIM: GoCatGo1956
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 
> > 
> > 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to