How to calculate Date Difference in Java?

Hi,

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

Thanks

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









Related Tutorials/Questions & Answers:
Advertisements