<!--- Date range --->
<CFSET date_start=CreateDate(2002, 1, 12)>
<CFSET date_end=CreateDate(2002, 1, 15)>

<!--- How many days in range --->
<CFSET dates=DateDiff("d", date_start, date_end)+1>

<!--- dates_list will hold generated list --->
<CFSET dates_list="">

<!--- Temp date var --->
<CFSET date_temp=date_start>

<!---
 Loop through days in range
 his is safer than an inline date compare in a conditional loop
 in case the end is less than the start --->
<CFLOOP INDEX="d" FROM="1" TO="#dates#">
 <!--- Append value to list, if diff format needed change mask --->
 <CFSET dates_list=ListAppend(dates_list, DateFormat(date_temp,
"M/D/YY"))>
 <!--- Increment date --->
 <CFSET date_temp=DateAdd("d", 1,  date_temp)>
</CFLOOP>

<!--- Here's the list --->
<CFOUTPUT>
#dates_list#
</CFOUTPUT>




-----Original Message-----
From: Jason Larson [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, January 31, 2002 9:04 PM
To: CF-Talk
Subject: Help with a list of dates


Alright heres my problem:

I have two dates: 
Startdate: 1/12/02 
Enddate: 1/15/02

How do I use cf to build a list of dates from the startdate to the
endate like i.e. (1/12/02,1/13/02,1/14/02,1/15/02).

Does anybody have any resources or code snippets that might shed some
light on this.

Thanks
Jason

Thanks,
Jason Larson
[EMAIL PROTECTED]

"You think the Cubs have sore arms? What about the fans in left field?" 
 
 



______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
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