title: Calulating the time difference in minutes and seconds
body: <p>How can i subtract from two timestamps (i need to concentrate only time diffeerence not dates)</p>
  
  <p>one is attendedInTime and other is plannedInTime, and these two times are in timestamp.</p>
  
  <p>I have written following query it is not working some scenario's. </p>
  
  <pre><code>SELECT (
     TO_NUMBER(substr(to_Char(attendedintime,'DD.MM.YYYY:HH24:MI:SS'), 12, 2) ) -  
     TO_NUMBER(substr(to_Char(plannedInTime, 'DD.MM.YYYY:HH24:MI:SS'), 12, 2) )
    ) 
     || ':' || 
   ( 
     TO_NUMBER(substr(to_Char(attendedintime,'DD.MM.YYYY:HH24:MI:SS'), 15, 2) ) - 
     TO_NUMBER(substr(to_Char(plannedInTime, 'DD.MM.YYYY:HH24:MI:SS'), 15, 2) )
   ) AS difference FROM TABLENAME 
  </code></pre>
  
  <p>But as per the above query i am not able syncup with the hours and minutes
  (It is calclating differently minutes and hours)</p>