Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

How to calculate Date Difference in Java?

Ads

 
 

Share on Google+Share on Google+

Java Coder
How to calculate Date Difference in Java?
1 Answer(s)      2 months and 8 days ago
Posted in : Java Beginners

Hi,

I have two dates variable. How to calculate Date Difference in Java?

Thanks

Ads
View Answers

April 16, 2017 at 8:42 PM


Hi,

You can use the Calendar class for calculating the date difference in Java.

Get data into milliseconds like this:

long milliseconds1 = calendar1.getTimeInMillis();

And then easily find the date difference.

Check tutorial Date Difference.

Thanks


Ads