How to calculate Date Difference in Java?

 
 

Share on Google+Share on Google+

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

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









Ads

 
Advertisement null

Ads