 <p>Here's how it works with <a href="http://joda-time.sourceforge.net" rel="nofollow noreferrer">Joda time</a>:</p> <pre><code>DateTime startTime, endTime; Period p = new Period(startTime, endTime); int hours = p.getHours(); int minutes = p.getMinutes(); </code></pre> <p>You could format with Joda's formatters, e.g., PeriodFormat, but I'd suggest using Java's. See <a href="http://stackoverflow.com/questions/275711/add-leading-zeroes-in-java">this question</a> for more details.</p>