I would have thought google would have been your first stop, rather than this forum.
My recommended solution would be to use a library.
Are you on Java 8? If so check out the new features in the java.time package. Specifically java.time.Period
Not on Java 8? Check out the joda-time library.