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
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4