Looping Over Times In ColdFusion

<!---
	When looping over the hours in the day, we are going to
	use an index loop and for each iteration, we are going
	to increase the index by a single hour (the numeric
	timespan representing an hour fraction of the day).
--->
<cfset dtHour = CreateTimeSpan(
	0, <!--- Days. --->
	1, <!--- Hours. --->
	0, <!--- Minutes. --->
	0 <!--- Seconds. --->
	) />
 
 
<!---
	When looping over the hours in the day, we can enter the
	start and end time as "readable" time. ColdFusion will
	automatically convert those time strings to their numeric
	equivalents for use within the index loop.
--->
<cfloop
	index="dtTime"
	from="8:00 AM"
	to="5:00 PM"
	step="#dtHour#">
 
	#TimeFormat( dtTime, "hh:mm TT" )#<br />
 
</cfloop>

For Cut-and-Paste