Question on time loop in cfloop
if I was looping 10:00–17:00 range, the 17:00 cann’t be output, but if was looping 08:00–15:00 range, the 15:00 can be output.
0.416666666668
10:00
0.458333333335
11:00
0.500000000001
12:00
0.541666666668
13:00
0.583333333335
14:00
0.625000000001
15:00
0.666666666668
16:00
0.333333333332
08:00
0.374999999999
09:00
0.416666666665
10:00
0.458333333332
11:00
0.499999999999
12:00
0.541666666665
13:00
0.583333333332
14:00
0.624999999999
15:00
<cfoutput>
<cfset startTime = createTime(10,0,0) />
<cfset endTime = createTime(17,0,0) />
<cfloop from=”#startTime#” to=”#endTime#” index=”oTime” step=”#createTimeSpan(0,1,0,0)#”>
<cfdump var=”#oTime#” /><br />
<cfdump var=”#timeFormat(oTime, ‘HH:mm’)#” /><br />
</cfloop>
<br />
<cfset startTime2 = createTime(8,0,0) />
<cfset endTime2 = createTime(15,0,0) />
<cfloop from=”#startTime2#” to=”#endTime2#” index=”oTime2″ step=”#createTimeSpan(0,1,0,0)#”>
<cfdump var=”#oTime2#” /><br />
<cfdump var=”#timeFormat(oTime2, ‘HH:mm’)#” /><br />
</cfloop>
</cfoutput>
You must be logged in to post a comment.