Mr.Chowdary
Mr.Chowdary

Reputation: 3407

Expecting difference of dates in number of months and days?

I have to find the difference between two dates in months and days. I tried Google, but I only found the difference in months and days. But I'm expecting difference in months and days.
Eg: 01 April 2013 and 07 May 2013 Then the result should be 1 month 6 days.
I want the code to be using only Java 6 provided api. It is recommended but not like Joda Time and other. Thanks for your help.

Upvotes: 0

Views: 113

Answers (1)

Ali Bahraminezhad
Ali Bahraminezhad

Reputation: 326

As far as I know there is not any provided api in Java to calculate the DateTime differences. You should use external api or do it yourself.

Check this link, there is a manual way to do it: http://www.mkyong.com/java/how-to-calculate-date-time-difference-in-java/

Upvotes: 1

Related Questions