On 9/5/02, Pete Ruckelshaus penned:
>My wife needed help writing a template so that she could put 
>together a regular and on-call schedule for work.  Pretty simple 
>requiremenets, really, she just asked me to generate a table that 
>dumped out a range of dates.  Easy-peasy, thinks I, I bet Cold 
>Fusion can do it in 3 lines of code.
>
>Wrong.  Not especially difficult, and I worked it out (using CFLOOP, 
>and a bunch of variables for current day, lastdayofyear(), etc.), 
>but it left me wondering why <cfloop> didn't allow you to loop 
>through a date object and increment by days, hours, minutes, 
>whatever?

Wouldn't dateadd work for you?

<cfset arg = "WW">
<cfset firstday = "0">

<CFOUTPUT>
<cfloop index="i" from="#firstday#" to="52">
#DateFormat(DateAdd(arg, i, firstdate), "DDD. MM/DD/YYYY")#<br>
</cfloop>
</CFOUTPUT>

This sample will show the next 52 weeks starting with today. Set 
firstday to 1 and it would start next week. Change arg to D, H, N, 
etc. to increment by Days, Hours, Minutes, etc.
-- 

Bud Schneehagen - Tropical Web Creations

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
ColdFusion Solutions / eCommerce Development
[EMAIL PROTECTED]
http://www.twcreations.com/
954.721.3452
______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to