title: Adding time in hours to a date object in java?
body: <p>How do i add hours to a date object. Below is my code:</p>
  
  <pre><code>String dateStart = timeStamp;
  String dateStop = valueCon;
  
  SimpleDateFormat format = new SimpleDateFormat("yy/MM/dd HH:mm:ss");
  
  Date d1 = null;
  Date d2 = null;
  
  d1 = format.parse(dateStart);
  d2 = format.parse(datestop);
  </code></pre>
  
  <p>I want to add 4 hours to d2 date object. How do i achieve it?</p>
  
  <p>I tried to use :</p>
  
  <pre><code>Date modd1= new Date(d2+TimeUnit.MINUTES.toHours(240));
  </code></pre>
  
  <p>But it accepts only long object for adding. Thus failed.</p>
  
  <p>Please support to solve this.Thanks in advance.</p>