title: Java-How to calculate accurate time difference while using Joda Time Jar
body: <p>I'm having problem with Joda time jar that I downloaded from <a href="http://sourceforge.net/projects/joda-time/files/joda-time/2.2/" rel="noreferrer">http://sourceforge.net/projects/joda-time/files/joda-time/2.2/</a> . I can get the result when I use the following snippet</p>
  
  <pre><code>static void timeDifferencewithJoda()  {
  
      String dateStart = "01/14/2012 09:29:58";
      String dateStop = "01/15/2012 10:31:48";
  
      SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
  
      Date d1 = null;
      Date d2 = null;
  
      try {
          d1 = format.parse(dateStart);
          d2 = format.parse(dateStop);
  
          DateTime dt1 = new DateTime(d1);
          DateTime dt2 = new DateTime(d2);
  
          System.out.print(Days.daysBetween(dt1, dt2).getDays() + " days, ");
          System.out.print(Hours.hoursBetween(dt1, dt2).getHours() % 24 + " hours, ");
          System.out.print(Minutes.minutesBetween(dt1, dt2).getMinutes() % 60 + " minutes, ");
          System.out.print(Seconds.secondsBetween(dt1, dt2).getSeconds() % 60 + " seconds.");
  
       } catch (Exception e) {
          e.printStackTrace();
       }
  
  }
  </code></pre>
  
  <p>The Result was </p>
  
  <pre><code>1 days, 1 hours, 1 minutes, 50 seconds.
  </code></pre>
  
  <p>But I face the confliction with this time difference .</p>
  
  <pre><code>01/14/2012 09:29:58
  
  01/15/2012 10:31:48
  </code></pre>
  
  <p>here the two time has been declared ,but there's no indication to the period like AM or PM.  ie., The time may be morning or evening .How to I get exact time difference ?</p>
  
  <p>Any help regarding this will be useful.</p>