title: Calculate the difference between two dates in hours:minutes:seconds?
body: <p>How can I calculate the difference between two dates and show it in the format hours:minutes:seconds?</p>
  <p>Example:</p>
  <pre class="lang-none prettyprint-override"><code>StartTime : 2016-12-20T04:30  
  EndTime   : 2016-12-22T05:00
  </code></pre>
  <p>The output should be <code>&quot;48hours 30minutes 0 seconds&quot;</code>.</p>
  <p>This is what I've tried:</p>
  <pre class="lang-java prettyprint-override"><code>Long diff = (endDate.get time() -startDate.gettime())/1000;    
  
  Log.d(&quot;App&quot;,&quot;difference in hour is&quot;+diff/1000/60/60);
  Mins = diff/1000/60;
  Seconds = diff/1000; 
  </code></pre>
  <p>Using this code I'm getting hours as a correct value. But the minute and seconds values are not getting their proper values.</p>