title: Adding times to existing time in java
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1555262/calculating-the-difference-between-two-java-date-instances">Calculating the Difference Between Two Java Date Instances</a>  </p>
  </blockquote>
  
  
  
  <p>I am not able to solve below problem please help me.That is i am adding existing time to some some more time (minutes ,seconds or hours).Iam not able to write bellow wt type I wrote i mention that is not given correct answer,</p>
  
  <pre><code>String allexam_end_time="18:59:00";//48540000
  long oneminute=60000;
  try{
      SimpleDateFormat sdfkk = new SimpleDateFormat("hh:mm:ss");
      Date reqEndtimekk = sdfkk.parse(allexam_end_time);
      long total=reqEndtimekk.getTime()+oneminute;
      System.out.println("TOtal miliseconds         "+reqEndtimekk.getTime()+oneminute);
      System.out.println("total---------"+total);
      int s = (int)(total / 1000) % 60;
      int m = (int)(total / (1000 * 60)) % 60;
      int h=  (int) (total / (1000 * 60 * 60)) % 24;
      System.out.println(h+":"+m+":"+s);
  }catch(Exception e){
  
  }
  </code></pre>
  
  <h2>Output</h2>
  
  <pre><code>    output is TOtal miliseconds4854000060000
      total---------48600000
      13:30:0
  </code></pre>
  
  <p>But I need answer that if  added one minute means outputshould 19:00:00
          How can solve?</p>