title: Sum hours between 2 days
body: <p>How to calculate hours between 2 days?</p>
  
  <p>I have tried this : </p>
  
  <pre><code>ABS(TO_DATE(t11.JAM_AKHIR,'HH24:MI:SS') - TO_DATE(t11.JAM_AWAL,'HH24:MI:SS')) * 24 AS SELISIH_JAM,
  </code></pre>
  
  <p>result : </p>
  
  <pre><code>| NO| JAM_AWAL    | JAM AKHIR    | SELISIH |
  | 1 | 16.30    | 18.30        | 2      |
  | 2 | 18.30    | 06.30        | 12      |
  | 3 | 18.30    | 08.00        | 10.5      |    (WRONG)
  </code></pre>
  
  <p>but, NO 3 is wrong. 
  and then I tried this : </p>
  
  <pre><code>CASE WHEN TO_DATE(t11.JAM_AWAL,'HH24:MI:SS') &lt; TO_DATE(t11.JAM_AKHIR,'HH24:MI:SS')
       THEN                           
            ABS(TO_DATE(t11.JAM_AKHIR,'HH24:MI:SS') - TO_DATE(t11.JAM_AWAL,'HH24:MI:SS')) *24
  
       WHEN TO_DATE(t11.JAM_AWAL,'HH24:MI:SS') &gt; TO_DATE(t11.JAM_AKHIR,'HH24:MI:SS')
       THEN                           
            ABS(TO_DATE(t11.JAM_AWAL,'HH24:MI:SS') - TO_DATE(t11.JAM_AKHIR,'HH24:MI:SS')) *24                               
  END SELISIH_JAM,
  </code></pre>
  
  <p>but still failed. please help me, thank you :)</p>