title: Java add dates of format dd:HH:mm:ss
body: <p>I have three dates as <code>String</code> objects in the format: <code>dd:HH:mm:ss</code> </p>
  
  <ul>
  <li><code>00:1:9:14</code> </li>
  <li><code>00:3:10:4</code></li>
  <li><code>00:3:39:49</code></li>
  </ul>
  
  <p>How do I add these dates in Java to get the sum (<code>00:7:59:07</code>)?</p>
  
  <p>Sample code:</p>
  
  <pre><code>SimpleDateFormat sdf = new SimpleDateFormat("dd:HH:mm:ss");
  Date d1 = sdf.parse("00:1:9:14");
  Date d2 = sdf.parse("00:3:10:4");
  Date d3 = sdf.parse("00:3:39:49");
  
  System.out.println(d1);
  System.out.println(d2);
  System.out.println(d3);
  Date d = new Date(d1.getTime() + d2.getTime() + d3.getTime());
  
  System.out.println(d);
  </code></pre>
  
  <p>Output(wrong):</p>
  
  <pre><code>Wed Dec 31 01:09:14 IST 1969
  Wed Dec 31 03:10:04 IST 1969
  Wed Dec 31 03:39:49 IST 1969
  Sun Dec 28 20:59:07 IST 1969
  </code></pre>