title: SQL datediff time calculation
body: <p>I have these fields in my T-SQL database - <code>startTime</code> and <code>endTime</code> and <code>processTime</code>.<br>
  The process time is the amount of time from start to end time.<br>
  So, one startTime example is <code>22:50:59</code> and its endTime is <code>23:14:23</code>.<br>
  Process time would be .39  (The current code):</p>
  
  <pre><code>SELECT convert( decimal(18,0), totalItems 
          /(datediff(ss,sessionStartTime,sessionEndTime)/60.00/60.00) ) 
    AS processTime
  </code></pre>
  
  <p>This seems to be working for the most part, but it doesn't work when the startTime and endTime span across a day - for example, a startTime is 23:17:27 and an endTime of 00:31:23.  </p>
  
  <p>In other words, they started at 10:17 p.m., and finished at about 12:31 a.m. the following morning, but SQL isn't seeing this, because the processTime is displaying as a negative number (-22.77)...<br>
  <strong>How do I convert these negative times into positive times?</strong>  </p>
  
  <p>I do have separate date fields - a <code>startDate</code>, and an <code>endDate</code>.</p>