Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Date difference in months

807588Apr 26 2005 — edited Feb 21 2009
How can I find the difference between two dates in months?
I assume I can't do this:

Date firstDate = 4/1/2000;
Date secondDate = 6/1/2002;

int monDiff = secondDate - firstDate;

Also is it better to use java date or sql date?

thx.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 21 2009
Added on Apr 26 2005
15 comments
324 views