How to calculate between two dates in Java

In this topic we will learn how to calculate the difference between two date in terms of Second/ Minutes / Hours / Days. By Using java class. In next section we will use Java api(JODA) to perform the same activity.

Output of the above code would be

 

What about the days that have 23 or 25 hours due to a DST transition?

6 Comments How to calculate between two dates in Java

  1. veeravelu

    good explanation.. you have to make small change in the 19 and 20 line .. keep going.. all the best.!

    Reply

Leave A Comment

Your email address will not be published. Required fields are marked *