title: ColdFusion Loops to Seemingly Different Times in Same Code
body: <p>Consider the following loop:</p>
  
  <pre><code>&lt;cfloop from="#timeFormat(roomAvail.startTime,'short')#" to="#timeFormat(roomAvail.endTime,'short')#" step="#CreateTimeSpan(0,0,30,0)#" index="time"&gt;
      &lt;cfoutput&gt;
          #timeFormat(time,'short')#&lt;br/&gt;
      &lt;/cfoutput&gt;
  &lt;/cfloop&gt;
  </code></pre>
  
  <p>When my input is from:<code>9:00 AM</code> to:<code>8:00 PM</code> the code outputs every 30 min increment from 9:00 AM to 7:30 PM.</p>
  
  <p>When my input is from:<code>10:00 AM</code> to:<code>1:00 PM</code> the code outputs every 30 min increment form 10:00 AM to 1:00 PM.</p>
  
  <p>Can anyone explain what is happening and why there is one 30 min segment missing from the first loop and not the second? I was told this was a valid method of looping over times, but I'm starting to think that because the time is rendered as a float in the underlying Java method, some rounding is occurring and it's screwing up.</p>
  
  <p>Edit: I really don't think it matters that I'm not passing in Date/Time objects. CF is casting that behind the scenes, otherwise the entire thing wouldn't work at all.</p>