Re: days of the month
Thanks to everyone who replied.I learned alot looking these over.I ended up using Charlies.It's really nice looking and easily modified. I had a couple of questions and comments about it. - it uses structKeyExists.I'm unfamilar with the term struct.Does that indicate a complex data type, like an object? - I hadn't seen 'writeOutput()' before.I guess that's only for in-line cfscripts. I hadn't seen those before either.It looks nice without all the cfifs and just ifs. - Is the var variables a cf owned (built-in) term or is it just a var that you created here?I don't see it defined before it has attributes added (ie variables.current_date). - I had some trouble grabbing the code off the web page.DW ignored all the spaces and it became one long sentence.I then tried to reformat it, causing some problems.I'm not complaining cause it saved me a bunch of time and looks really cool, but it might be nice to offer it as a linked, file download. Again, thanks for all the replies and the great calendar. I'm writing an event calendar: http://hhp.umd.edu/HHPv1/hhp_index.cfm I need to determine the day numbering.It would seem that I need the number of days in the month and the DAY that 'day1' begins on (thurs, fri, etc.) so I can fill the predecessors with blanks.I'll also need to determine this for future/other months. I guess I'll need to determine the DAY for each date too, so I can designate them with a 'weekend' color. Are there possibly general calendar tutorials that would use the same information? Am I missing anything else? thanks. -- Daniel Kessler Department of Public and Community Health University of Maryland Suite 2387 Valley Drive College Park, MD20742-2611 301-405-2545 Phone www.phi.umd.edu [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: days of the month
- it uses structKeyExists.I'm unfamilar with the term struct.Does that indicate a complex data type, like an object? Functions that start with Struct...() manipulate structures. This is a complex datatype in CF (associative array or object without methods) - I hadn't seen 'writeOutput()' before.I guess that's only for in-line cfscripts. I hadn't seen those before either.It looks nice without all the cfifs and just ifs. cfscript is for the CF scripting language. You need the 'WriteOutput()' function to output to the page when using cfscript. - Is the var variables a cf owned (built-in) term or is it just a var that you created here?I don't see it defined before it has attributes added (ie variables.current_date). variables is the prefix of the page's local variable scope (like 'request', 'session', 'application', ...). In CFMX this is a built in structure. You should always use the prefixes when referencing variables (if they have one). Pascal Peters Certified ColdFusion MX Advanced Developer Macromedia Certified Instructor LR Technologies Av. E. De Mot, 19 1000 BRUSSELS, BELGIUM [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: days of the month
Hi Daniel: 1) structKeyExists() - I use this to check the URL scope for the 'mo' and 'yr' variables.It's really the same as cfif isDefined('URL.mo') (or in cfscript if (isDefined('URL.mo')) { do something here }.Arguably, it's a little bit faster to use the structKeyExists() function.I believe the rationale was that it's just checking a structure for the existence of a key, whereas isDefined() actually has to parse a string (the argument), which is relatively slow. 2) writeOutput() is the same as document.write() in JS.it simply writes output to the screen.Honestly, I don't know how 'correct' my usage of it was in the calendar.My goal in the calendar wasn't necessarily to go for a best practice approach...but rather a can I build a calender in 100% cfscript approach. 3) the 'variables' scope is just the local scope. cfset myVar = foo is the same as cfset variables.myVar = foo.The latter is just more explicit, whichwould prevent any scope hunting as well as making the code a bit more readable/self-documenting. 4) noted: ) Glad you were able to put the code to use. Charlie - Original Message - From: daniel kessler [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, May 14, 2004 6:47 AM Subject: Re: days of the month Thanks to everyone who replied.I learned alot looking these over.I ended up using Charlies.It's really nice looking and easily modified. I had a couple of questions and comments about it. - it uses structKeyExists.I'm unfamilar with the term struct.Does that indicate a complex data type, like an object? - I hadn't seen 'writeOutput()' before.I guess that's only for in-line cfscripts. I hadn't seen those before either.It looks nice without all the cfifs and just ifs. - Is the var variables a cf owned (built-in) term or is it just a var that you created here?I don't see it defined before it has attributes added (ie variables.current_date). - I had some trouble grabbing the code off the web page.DW ignored all the spaces and it became one long sentence.I then tried to reformat it, causing some problems.I'm not complaining cause it saved me a bunch of time and looks really cool, but it might be nice to offer it as a linked, file download. Again, thanks for all the replies and the great calendar. I'm writing an event calendar: http://hhp.umd.edu/HHPv1/hhp_index.cfm I need to determine the day numbering.It would seem that I need the number of days in the month and the DAY that 'day1' begins on (thurs, fri, etc.) so I can fill the predecessors with blanks.I'll also need to determine this for future/other months. I guess I'll need to determine the DAY for each date too, so I can designate them with a 'weekend' color. Are there possibly general calendar tutorials that would use the same information? Am I missing anything else? thanks. -- Daniel Kessler Department of Public and Community Health University of Maryland Suite 2387 Valley Drive College Park, MD20742-2611 301-405-2545 Phone www.phi.umd.edu [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: days of the month
ok that helps. thanks for the explaination. - it uses structKeyExists.I'm unfamilar with the term struct.Does that indicate a complex data type, like an object? Functions that start with Struct...() manipulate structures. This is a complex datatype in CF (associative array or object without methods) - I hadn't seen 'writeOutput()' before.I guess that's only for in-line cfscripts. I hadn't seen those before either.It looks nice without all the cfifs and just ifs. cfscript is for the CF scripting language. You need the 'WriteOutput()' function to output to the page when using cfscript. - Is the var variables a cf owned (built-in) term or is it just a var that you created here?I don't see it defined before it has attributes added (ie variables.current_date). variables is the prefix of the page's local variable scope (like 'request', 'session', 'application', ...). In CFMX this is a built in structure. You should always use the prefixes when referencing variables (if they have one). Pascal Peters Certified ColdFusion MX Advanced Developer Macromedia Certified Instructor LR Technologies Av. E. De Mot, 19 1000 BRUSSELS, BELGIUM [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: days of the month
If you want the actual DAY (Monday, Tuesday) for the given day: DayOfWeekAsString(Now()) - will give you Monday, Tuesday, etc... DayOfWeek(Now()) - will give you: 1 - Sunday 2 - Monday .. .. 7 - Saturday Day(Now()) - will give you the actually day of the month as a numeric such as for today it would be 13 since today is May 13th. -Original Message- From: Daniel Kessler [mailto:[EMAIL PROTECTED] Sent: Thursday, May 13, 2004 11:06 AM To: CF-Talk Subject: days of the month I'm writing an event calendar: http://hhp.umd.edu/HHPv1/hhp_index.cfm I need to determine the day numbering.It would seem that I need the number of days in the month and the DAY that 'day1' begins on (thurs, fri, etc.) so I can fill the predecessors with blanks.I'll also need to determine this for future/other months. I guess I'll need to determine the DAY for each date too, so I can designate them with a 'weekend' color. Are there possibly general calendar tutorials that would use the same information? Am I missing anything else? thanks. -- Daniel Kessler Department of Public and Community Health University of Maryland Suite 2387 Valley Drive College Park, MD20742-2611 301-405-2545 Phone www.phi.umd.edu _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: days of the month
I don't know if this will help you or not.I have a calendar application that uses this script/ !--- Set Date parameters used in the where clause of the query --- cfscript firstOfMonth = CreateDate(year,month,1); endOfMonth = CreateDate(year,month,DaysInMonth(firstOfMonth)); startday = 2; //1=Sunday, 2=Monday, ..., 7=Saturday //calculate first day of calendar display. daynum = DayOfWeek(firstOfMonth); if (daynum - (startday - 1) LT 1) offset = 7 + (daynum - (startday - 1)); else offset = (daynum - (startday - 1)); firstDay = DateAdd(d,-(offset-1),firstOfMonth); //calculate last day of calendar dispay daynum = DayOfWeek(endOfMonth); if (daynum - (startday - 1) LT 1) offset = -(daynum - (startday - 1)); else offset = 7 - (daynum - (startday - 1)); lastDay = DateAdd(d,offset,endOfMonth); /cfscript Now this does not display blanks at the beginning and end.It displays records for the days of the previous month and next month.For example: This month it goes: Mon Apr 26|Tue Apr 27|Wed Apr 28|Thu Apr 29|Fri Apr 30|Sat May 1{Sun May 2 ... Mon May 31|Tue Jun 1|Wed Jun 2|Thu Jun 3|Fri Jun 4|Sat Jun 5|Sun Jun 6 HTH -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA C code. C code run. Run code run. Please! - Cynthia Dunning Confidentiality Notice:This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: days of the month
Daniel: I did a cfscript calendar that i think addresses all of your concerns. see http://charlie.griefer.com/code/cfscript_calendar.cfm hth, Charlie - Original Message - From: Daniel Kessler [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, May 13, 2004 8:06 AM Subject: days of the month I'm writing an event calendar: http://hhp.umd.edu/HHPv1/hhp_index.cfm I need to determine the day numbering.It would seem that I need the number of days in the month and the DAY that 'day1' begins on (thurs, fri, etc.) so I can fill the predecessors with blanks.I'll also need to determine this for future/other months. I guess I'll need to determine the DAY for each date too, so I can designate them with a 'weekend' color. Are there possibly general calendar tutorials that would use the same information? Am I missing anything else? thanks. -- Daniel Kessler Department of Public and Community Health University of Maryland Suite 2387 Valley Drive College Park, MD20742-2611 301-405-2545 Phone www.phi.umd.edu [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: days of the month
very cool charlie. now, what about the same thing extended to take events scheduled on dates, and show something in the calendar for that, like a planner. wonder what that would take? tw -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: Thursday, May 13, 2004 11:55 AM To: CF-Talk Subject: Re: days of the month Daniel: I did a cfscript calendar that i think addresses all of your concerns. see http://charlie.griefer.com/code/cfscript_calendar.cfm hth, Charlie - Original Message - From: Daniel Kessler [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, May 13, 2004 8:06 AM Subject: days of the month I'm writing an event calendar: http://hhp.umd.edu/HHPv1/hhp_index.cfm I need to determine the day numbering.It would seem that I need the number of days in the month and the DAY that 'day1' begins on (thurs, fri, etc.) so I can fill the predecessors with blanks.I'll also need to determine this for future/other months. I guess I'll need to determine the DAY for each date too, so I can designate them with a 'weekend' color. Are there possibly general calendar tutorials that would use the same information? Am I missing anything else? thanks. -- Daniel Kessler Department of Public and Community Health University of Maryland Suite 2387 Valley Drive College Park, MD20742-2611 301-405-2545 Phone www.phi.umd.edu [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: days of the month
yeah,like a little dot, showing, that there is something scheduled for that day. might be an idea. tw -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: Thursday, May 13, 2004 12:17 PM To: CF-Talk Subject: Re: days of the month heh.dunno.this was more of an i'm learning cfscript...I wonder if I can do this kind of thing.has the basic functionality of showing the previous month's and next month's days (as appropriate), which was one of the things Daniel was looking for.I forgot that it doesn't have weekends in a different color...but that would be easy enough to add using dayOfWeek(). i guess extending it to show scheduled events shouldn't be too difficult. query the db, loop over the query results for each day, and populate the cell with the event (if there is one). one thing I hate about web-based event calendars tho is that when you put the event itself inside the calendar, the formatting goes to hell.I think just some sort of indicator in the cell that there's an event (or events) on that day...and then a link to show a detailed day view. Charlie - Original Message - From: Tony Weeg [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, May 13, 2004 8:57 AM Subject: RE: days of the month very cool charlie. now, what about the same thing extended to take events scheduled on dates, and show something in the calendar for that, like a planner. wonder what that would take? tw -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: Thursday, May 13, 2004 11:55 AM To: CF-Talk Subject: Re: days of the month Daniel: I did a cfscript calendar that i think addresses all of your concerns. see http://charlie.griefer.com/code/cfscript_calendar.cfm hth, Charlie - Original Message - From: Daniel Kessler [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, May 13, 2004 8:06 AM Subject: days of the month I'm writing an event calendar: http://hhp.umd.edu/HHPv1/hhp_index.cfm I need to determine the day numbering.It would seem that I need the number of days in the month and the DAY that 'day1' begins on (thurs, fri, etc.) so I can fill the predecessors with blanks.I'll also need to determine this for future/other months. I guess I'll need to determine the DAY for each date too, so I can designate them with a 'weekend' color. Are there possibly general calendar tutorials that would use the same information? Am I missing anything else? thanks. -- Daniel Kessler Department of Public and Community Health University of Maryland Suite 2387 Valley Drive College Park, MD20742-2611 301-405-2545 Phone www.phi.umd.edu [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: days of the month
I just added a bit of code to check my data and if the date has an event schedules I change the border in the day to red looks nice and works even on current days! BTW thanks Charlie for sharing this bit of code, you've made my boss happy in that I was able to get a calendar (which he asked for this morning) out to him in an hour! Made me look like super coder.. ERJ - Original Message - From: Tony Weeg To: CF-Talk Sent: Thursday, May 13, 2004 11:02 AM Subject: RE: days of the month yeah,like a little dot, showing, that there is something scheduled for that day. might be an idea. tw -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: Thursday, May 13, 2004 12:17 PM To: CF-Talk Subject: Re: days of the month heh.dunno.this was more of an i'm learning cfscript...I wonder if I can do this kind of thing.has the basic functionality of showing the previous month's and next month's days (as appropriate), which was one of the things Daniel was looking for.I forgot that it doesn't have weekends in a different color...but that would be easy enough to add using dayOfWeek(). i guess extending it to show scheduled events shouldn't be too difficult. query the db, loop over the query results for each day, and populate the cell with the event (if there is one). one thing I hate about web-based event calendars tho is that when you put the event itself inside the calendar, the formatting goes to hell.I think just some sort of indicator in the cell that there's an event (or events) on that day...and then a link to show a detailed day view. Charlie - Original Message - From: Tony Weeg [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, May 13, 2004 8:57 AM Subject: RE: days of the month very cool charlie. now, what about the same thing extended to take events scheduled on dates, and show something in the calendar for that, like a planner. wonder what that would take? tw -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: Thursday, May 13, 2004 11:55 AM To: CF-Talk Subject: Re: days of the month Daniel: I did a cfscript calendar that i think addresses all of your concerns. see http://charlie.griefer.com/code/cfscript_calendar.cfm hth, Charlie - Original Message - From: Daniel Kessler [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, May 13, 2004 8:06 AM Subject: days of the month I'm writing an event calendar: http://hhp.umd.edu/HHPv1/hhp_index.cfm I need to determine the day numbering.It would seem that I need the number of days in the month and the DAY that 'day1' begins on (thurs, fri, etc.) so I can fill the predecessors with blanks.I'll also need to determine this for future/other months. I guess I'll need to determine the DAY for each date too, so I can designate them with a 'weekend' color. Are there possibly general calendar tutorials that would use the same information? Am I missing anything else? thanks. -- Daniel Kessler Department of Public and Community Health University of Maryland Suite 2387 Valley Drive College Park, MD20742-2611 301-405-2545 Phone www.phi.umd.edu [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: days of the month
you guys might want to check out the calendar in ray camden's blog http://www.camdenfamily.com/morpheus/blog/ while still gregorian calendar based it handles ISO, BIDI, locales, etc. well enough. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: days of the month
Our calendar works similar to that as well with the day colorings and day calculation, etc. Nice work on both those calendars. http://www.gckschools.com/calendar.cfm -Original Message- From: Eric Jones [mailto:[EMAIL PROTECTED] Sent: Thursday, May 13, 2004 1:09 PM To: CF-Talk Subject: Re: days of the month I just added a bit of code to check my data and if the date has an event schedules I change the border in the day to red looks nice and works even on current days! BTW thanks Charlie for sharing this bit of code, you've made my boss happy in that I was able to get a calendar (which he asked for this morning) out to him in an hour! Made me look like super coder.. ERJ - Original Message - From: Tony Weeg To: CF-Talk Sent: Thursday, May 13, 2004 11:02 AM Subject: RE: days of the month yeah,like a little dot, showing, that there is something scheduled for that day. might be an idea. tw -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: Thursday, May 13, 2004 12:17 PM To: CF-Talk Subject: Re: days of the month heh.dunno.this was more of an i'm learning cfscript...I wonder if I can do this kind of thing.has the basic functionality of showing the previous month's and next month's days (as appropriate), which was one of the things Daniel was looking for.I forgot that it doesn't have weekends in a different color...but that would be easy enough to add using dayOfWeek(). i guess extending it to show scheduled events shouldn't be too difficult. query the db, loop over the query results for each day, and populate the cell with the event (if there is one). one thing I hate about web-based event calendars tho is that when you put the event itself inside the calendar, the formatting goes to hell.I think just some sort of indicator in the cell that there's an event (or events) on that day...and then a link to show a detailed day view. Charlie - Original Message - From: Tony Weeg [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, May 13, 2004 8:57 AM Subject: RE: days of the month very cool charlie. now, what about the same thing extended to take events scheduled on dates, and show something in the calendar for that, like a planner. wonder what that would take? tw -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: Thursday, May 13, 2004 11:55 AM To: CF-Talk Subject: Re: days of the month Daniel: I did a cfscript calendar that i think addresses all of your concerns. see http://charlie.griefer.com/code/cfscript_calendar.cfm hth, Charlie - Original Message - From: Daniel Kessler [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, May 13, 2004 8:06 AM Subject: days of the month I'm writing an event calendar: http://hhp.umd.edu/HHPv1/hhp_index.cfm I need to determine the day numbering.It would seem that I need the number of days in the month and the DAY that 'day1' begins on (thurs, fri, etc.) so I can fill the predecessors with blanks.I'll also need to determine this for future/other months. I guess I'll need to determine the DAY for each date too, so I can designate them with a 'weekend' color. Are there possibly general calendar tutorials that would use the same information? Am I missing anything else? thanks. -- Daniel Kessler Department of Public and Community Health University of Maryland Suite 2387 Valley Drive College Park, MD20742-2611 301-405-2545 Phone www.phi.umd.edu _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: days in a month
You are calling the daysInMonth function on a number, not a real date, and you don't need it anyway. Just change the option line to option value=#firstday##firstday#/option === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Tim Laureska [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 2:25 PM To: CF-Talk Subject: days in a month Hello. I'm trying to simplify the code for a drop down list of total # of possible days in a month (31). to look something like what I'm using to display months in a year, which looks like this: select name=firstmonth size=1 cfloop index=firstmonth FROM=1 TO=12 cfoutput option value=#firstmonth##MonthasString(firstmonth)# /cfoutput /cfloop /option /select I tried the code below but it only returns the number 31 in the drop down box (I'm not sure this function was meant for this type of thing anyway): select name=firstday cfloop index=firstday FROM=1 TO=31 cfoutput option value=#firstday##daysinmonth(firstday)# /cfoutput /cfloop /option /select Tim ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: days in a month
cfset theMonth = 1 select name=firstday cfloop index=theDay FROM=1 TO=#daysinmonth(theMonth)# cfoutput option value=#theDay##theDay# /cfoutput /cfloop /option /select - Original Message - From: Tim Laureska [EMAIL PROTECTED] Date: Tuesday, February 18, 2003 1:24 pm Subject: days in a month Hello. I'm trying to simplify the code for a drop down list of total # of possible days in a month (31). to look something like what I'm usingto display months in a year, which looks like this: select name=firstmonth size=1 cfloop index=firstmonth FROM=1 TO=12 cfoutput option value=#firstmonth##MonthasString(firstmonth)# /cfoutput /cfloop /option /select I tried the code below but it only returns the number 31 in the drop down box (I'm not sure this function was meant for this type of thing anyway): select name=firstday cfloop index=firstday FROM=1 TO=31 cfoutput option value=#firstday##daysinmonth(firstday)# /cfoutput /cfloop /option /select Tim ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: days in a month
tim.. select name=monthList cfloop from=1 to=#DaysInMonth(dateFormat(Now(),'mm/y'))# index=i step=1 cfoutput option value=#i##i# /cfoutput /cfloop /select try this... ...tony Tony Weeg Senior Web Developer UnCertified Advanced ColdFusion Developer Information System Design Navtrak, Inc. Mobile workforce monitoring, mapping reporting www.navtrak.net 410.548.2337 -Original Message- From: Tim Laureska [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 3:25 PM To: CF-Talk Subject: days in a month Hello. I'm trying to simplify the code for a drop down list of total # of possible days in a month (31). to look something like what I'm using to display months in a year, which looks like this: select name=firstmonth size=1 cfloop index=firstmonth FROM=1 TO=12 cfoutput option value=#firstmonth##MonthasString(firstmonth)# /cfoutput /cfloop /option /select I tried the code below but it only returns the number 31 in the drop down box (I'm not sure this function was meant for this type of thing anyway): select name=firstday cfloop index=firstday FROM=1 TO=31 cfoutput option value=#firstday##daysinmonth(firstday)# /cfoutput /cfloop /option /select Tim ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=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
Re: days in a month
Daysinmonth() requires a date as a parameter. It'll give you the number of days for the relevant month. E.g. daysinmonth(now()) = 28. For your code, you probably don't know which month so it's best left as 31 I'm guessing. - Original Message - From: Tim Laureska [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, February 19, 2003 9:24 AM Subject: days in a month Hello. I'm trying to simplify the code for a drop down list of total # of possible days in a month (31). to look something like what I'm using to display months in a year, which looks like this: select name=firstmonth size=1 cfloop index=firstmonth FROM=1 TO=12 cfoutput option value=#firstmonth##MonthasString(firstmonth)# /cfoutput /cfloop /option /select I tried the code below but it only returns the number 31 in the drop down box (I'm not sure this function was meant for this type of thing anyway): select name=firstday cfloop index=firstday FROM=1 TO=31 cfoutput option value=#firstday##daysinmonth(firstday)# /cfoutput /cfloop /option /select Tim ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=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
RE: days in a month
Thanks to all that responded... Raymond yours appeared the easiest... I need to understand loops better or something, that was just too easy... If someone would humor me or is real bored, could you explain why/mechanics of how this works to produce the number list 1-31: select name=firstday cfloop index=firstday FROM=1 TO=31 cfoutput option value=#firstday##firstday#/option /cfoutput /cfloop /option /select -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 3:18 PM To: CF-Talk Subject: RE: days in a month You are calling the daysInMonth function on a number, not a real date, and you don't need it anyway. Just change the option line to option value=#firstday##firstday#/option === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Tim Laureska [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 2:25 PM To: CF-Talk Subject: days in a month Hello. I'm trying to simplify the code for a drop down list of total # of possible days in a month (31). to look something like what I'm using to display months in a year, which looks like this: select name=firstmonth size=1 cfloop index=firstmonth FROM=1 TO=12 cfoutput option value=#firstmonth##MonthasString(firstmonth)# /cfoutput /cfloop /option /select I tried the code below but it only returns the number 31 in the drop down box (I'm not sure this function was meant for this type of thing anyway): select name=firstday cfloop index=firstday FROM=1 TO=31 cfoutput option value=#firstday##daysinmonth(firstday)# /cfoutput /cfloop /option /select Tim ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: days in a month
To make things easier, let's remove the HTML and just do: cfloop index=firstday from=1 to=31 cfoutput#firstday#/cfoutput /cfloop This looks much simpler, right? The mechanics of this is very simple. The CFLOOP tag simply says to loop from one number to another. In this case, it is from 1 to 31. The index=firstday means that CF should create a variable, named firstDay, that will hold the current index of the loop. Make sense? === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Tim Laureska [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 2:55 PM To: CF-Talk Subject: RE: days in a month Thanks to all that responded... Raymond yours appeared the easiest... I need to understand loops better or something, that was just too easy... If someone would humor me or is real bored, could you explain why/mechanics of how this works to produce the number list 1-31: select name=firstday cfloop index=firstday FROM=1 TO=31 cfoutput option value=#firstday##firstday#/option /cfoutput /cfloop /option /select -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 3:18 PM To: CF-Talk Subject: RE: days in a month You are calling the daysInMonth function on a number, not a real date, and you don't need it anyway. Just change the option line to option value=#firstday##firstday#/option == = Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Tim Laureska [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 2:25 PM To: CF-Talk Subject: days in a month Hello. I'm trying to simplify the code for a drop down list of total # of possible days in a month (31). to look something like what I'm using to display months in a year, which looks like this: select name=firstmonth size=1 cfloop index=firstmonth FROM=1 TO=12 cfoutput option value=#firstmonth##MonthasString(firstmonth)# /cfoutput /cfloop /option /select I tried the code below but it only returns the number 31 in the drop down box (I'm not sure this function was meant for this type of thing anyway): select name=firstday cfloop index=firstday FROM=1 TO=31 cfoutput option value=#firstday##daysinmonth(firstday)# /cfoutput /cfloop /option /select Tim ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: days in a month
tim the value of whatever you set the index parameter to ends up equaling the iteration that the value of the loop is. ...tony Tony Weeg Senior Web Developer UnCertified Advanced ColdFusion Developer Information System Design Navtrak, Inc. Mobile workforce monitoring, mapping reporting www.navtrak.net 410.548.2337 -Original Message- From: Tim Laureska [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 3:55 PM To: CF-Talk Subject: RE: days in a month Thanks to all that responded... Raymond yours appeared the easiest... I need to understand loops better or something, that was just too easy... If someone would humor me or is real bored, could you explain why/mechanics of how this works to produce the number list 1-31: select name=firstday cfloop index=firstday FROM=1 TO=31 cfoutput option value=#firstday##firstday#/option /cfoutput /cfloop /option /select -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 3:18 PM To: CF-Talk Subject: RE: days in a month You are calling the daysInMonth function on a number, not a real date, and you don't need it anyway. Just change the option line to option value=#firstday##firstday#/option === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Tim Laureska [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 2:25 PM To: CF-Talk Subject: days in a month Hello. I'm trying to simplify the code for a drop down list of total # of possible days in a month (31). to look something like what I'm using to display months in a year, which looks like this: select name=firstmonth size=1 cfloop index=firstmonth FROM=1 TO=12 cfoutput option value=#firstmonth##MonthasString(firstmonth)# /cfoutput /cfloop /option /select I tried the code below but it only returns the number 31 in the drop down box (I'm not sure this function was meant for this type of thing anyway): select name=firstday cfloop index=firstday FROM=1 TO=31 cfoutput option value=#firstday##daysinmonth(firstday)# /cfoutput /cfloop /option /select Tim ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=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
RE: days in a month
yes, however to not hard code the number of days, what I did, gets around that (although its very elementary, but it makes it a dynamic value) ...tony Tony Weeg Senior Web Developer UnCertified Advanced ColdFusion Developer Information System Design Navtrak, Inc. Mobile workforce monitoring, mapping reporting www.navtrak.net 410.548.2337 -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 3:52 PM To: CF-Talk Subject: RE: days in a month To make things easier, let's remove the HTML and just do: cfloop index=firstday from=1 to=31 cfoutput#firstday#/cfoutput /cfloop This looks much simpler, right? The mechanics of this is very simple. The CFLOOP tag simply says to loop from one number to another. In this case, it is from 1 to 31. The index=firstday means that CF should create a variable, named firstDay, that will hold the current index of the loop. Make sense? === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Tim Laureska [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 2:55 PM To: CF-Talk Subject: RE: days in a month Thanks to all that responded... Raymond yours appeared the easiest... I need to understand loops better or something, that was just too easy... If someone would humor me or is real bored, could you explain why/mechanics of how this works to produce the number list 1-31: select name=firstday cfloop index=firstday FROM=1 TO=31 cfoutput option value=#firstday##firstday#/option /cfoutput /cfloop /option /select -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 3:18 PM To: CF-Talk Subject: RE: days in a month You are calling the daysInMonth function on a number, not a real date, and you don't need it anyway. Just change the option line to option value=#firstday##firstday#/option == = Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Tim Laureska [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 2:25 PM To: CF-Talk Subject: days in a month Hello. I'm trying to simplify the code for a drop down list of total # of possible days in a month (31). to look something like what I'm using to display months in a year, which looks like this: select name=firstmonth size=1 cfloop index=firstmonth FROM=1 TO=12 cfoutput option value=#firstmonth##MonthasString(firstmonth)# /cfoutput /cfloop /option /select I tried the code below but it only returns the number 31 in the drop down box (I'm not sure this function was meant for this type of thing anyway): select name=firstday cfloop index=firstday FROM=1 TO=31 cfoutput option value=#firstday##daysinmonth(firstday)# /cfoutput /cfloop /option /select Tim ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: days in a month
This is the third time I've tried to reply to your messages ... hope it goes thru this time It makes sense if what I'm about to say is correct... your code loops over the variable #firstday# 31 times and #firstday# takes the value of the index named firstday each time it loops. Now, Tony's code is a bit more refined than mine because it outputs the number of days in the month we're currently in, correct? -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 3:52 PM To: CF-Talk Subject: RE: days in a month To make things easier, let's remove the HTML and just do: cfloop index=firstday from=1 to=31 cfoutput#firstday#/cfoutput /cfloop This looks much simpler, right? The mechanics of this is very simple. The CFLOOP tag simply says to loop from one number to another. In this case, it is from 1 to 31. The index=firstday means that CF should create a variable, named firstDay, that will hold the current index of the loop. Make sense? === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Tim Laureska [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 2:55 PM To: CF-Talk Subject: RE: days in a month Thanks to all that responded... Raymond yours appeared the easiest... I need to understand loops better or something, that was just too easy... If someone would humor me or is real bored, could you explain why/mechanics of how this works to produce the number list 1-31: select name=firstday cfloop index=firstday FROM=1 TO=31 cfoutput option value=#firstday##firstday#/option /cfoutput /cfloop /option /select -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 3:18 PM To: CF-Talk Subject: RE: days in a month You are calling the daysInMonth function on a number, not a real date, and you don't need it anyway. Just change the option line to option value=#firstday##firstday#/option == = Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Tim Laureska [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 2:25 PM To: CF-Talk Subject: days in a month Hello. I'm trying to simplify the code for a drop down list of total # of possible days in a month (31). to look something like what I'm using to display months in a year, which looks like this: select name=firstmonth size=1 cfloop index=firstmonth FROM=1 TO=12 cfoutput option value=#firstmonth##MonthasString(firstmonth)# /cfoutput /cfloop /option /select I tried the code below but it only returns the number 31 in the drop down box (I'm not sure this function was meant for this type of thing anyway): select name=firstday cfloop index=firstday FROM=1 TO=31 cfoutput option value=#firstday##daysinmonth(firstday)# /cfoutput /cfloop /option /select Tim ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: days in a month
It makes sense if what I'm about to say is correct... your code loops over the variable #firstday# 31 times and #firstday# takes the value of the index named firstday each time it loops. Err - yea - kinda. Your wording is a bit convaluted - but maybe it's just me. Think of it like this - ColdFusion says to itself I'm going to loop from 1 to 31, and store the current row in a variable called Whatever Now, Tony's code is a bit more refined than mine because it outputs the number of days in the month we're currently in, correct? Correct (well, I thikn so, I don't remember Tony's code exactly). I didn't make my code do that because I thought you were asking for a select box that asked the user how many days were in the month. On a side note - why would you -ever- ask the user that? Just ask the user for the month and year and CF can figure out how many days are in the month. === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: days in a month
FYI - sometimes people find themselves running the same loop over and over again in a page. For example if you have a page that lets the user pick 4 or 5 different dates then you might find yourself looping over the days in a month 4 or 5 times. In times like this it is much faster to run the loop once and record the results to a string, then use the string in 4 or 5 different places +---+ Bryan Love Macromedia Certified Professional Internet Application Developer Database Analyst TeleCommunication Systems [EMAIL PROTECTED] +---+ ...'If there must be trouble, let it be in my day, that my child may have peace'... - Thomas Paine, The American Crisis Let's Roll - Todd Beamer, Flight 93 -Original Message- From: Tim Laureska [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 12:25 PM To: CF-Talk Subject: days in a month Hello. I'm trying to simplify the code for a drop down list of total # of possible days in a month (31). to look something like what I'm using to display months in a year, which looks like this: select name=firstmonth size=1 cfloop index=firstmonth FROM=1 TO=12 cfoutput option value=#firstmonth##MonthasString(firstmonth)# /cfoutput /cfloop /option /select I tried the code below but it only returns the number 31 in the drop down box (I'm not sure this function was meant for this type of thing anyway): select name=firstday cfloop index=firstday FROM=1 TO=31 cfoutput option value=#firstday##daysinmonth(firstday)# /cfoutput /cfloop /option /select Tim ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4