> I'm creating a calendar and need to know how to make the days
> start on the day the month starts one.. IE.. December has 31
> days and starts on Wednesday. So for December I have created
First get the DayOfTheWeek of the start and end of the month.
Then work out the number steps back from the start day no to your first
day of the month.
Then your calendar start date is startdate of month minus the no days to
start of week.
Your calendar end date is enddate of month plus the 7 -
DayOfWeek(enddate)
Heads up that the CF DayOfWeek returns Sunday as the first day of the
week, whereas the Week() funciton uses Monday... Caught me anyway, make
sure you use the ISO functions on cflib for that sort of calc.
Code might make a bit more sense...
<!--- SNIPPET OF CODE --->
<cfset iDayOfWeekFirst =
request.fn.DayOfWeekISO(caller.variables.calendar.config.datestart)>
<cfset iDayOfWeekLast =
request.fn.DayOfWeekISO(caller.variables.calendar.config.dateend)>
<!--- Work out the first and last cells date's and the number of cells
between them --->
<cfset calendar.display.datemin = dateAdd("d", (-1 *
(iDayOfWeekFirst-1)), calendar.config.datestart)>
<cfset calendar.display.datemax = dateAdd("d", (7-iDayOfWeekLast),
calendar.config.dateend)>
Then loop over the calendar.display.datemin and calendar.display.datemin
vars(as opposed to datestart and dateend above) and you should have a
nice square calendar :)
When you hit december (cos you know what date it is for each div in the
loop right?) you then just start outputting your normal calendar.
Hope that makes sense
> 35 divs using a <cfloop> I run a query return days, first day
I used a table as it is tabular data :)
--
dc
> -----Original Message-----
> From: Greg Morphis [mailto:[EMAIL PROTECTED]
> Sent: 09 December 2004 17:06
> To: CF-Talk
> Subject: Creating a Calendar
>
>
> I'm creating a calendar and need to know how to make the days
> start on the day the month starts one.. IE.. December has 31
> days and starts on Wednesday. So for December I have created
> 35 divs using a <cfloop> I run a query return days, first day
> of month, the number of weeks in the month (1-5) In my cfloop
> I have.. <cfloop from="1" to="#cal.maxweek*7#" index="i">
> <div class="day">
> <cfoutput>#cal.rn[i]#</cfoutput>
> </div>
> <cfif i mod 7 eq 0></br></cfif>
> </cfloop>
>
> this creates the calendar but it always starts at the first
> cell. so it looks like
> 1 2 3 4 5 6 7
> 8 9 10 11 12 13 14
> etc..
> but should look like
> 1 2 3 4
> 5 6 7 8 9 10 11
> etc..
> So how do I make this skip the first 3 divs?
>
>
> --
> Auxilium meum a Domino
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186853
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54