You can take a look at DateUtils , which offers some utility methods for calculating the elapsed time between two dates, but only for presentation. Do not use the direct approach for converting between days / milliseconds, since it does not take into account leap years, leap seconds, summer / winter time changes, etc. These considerations are handled by the Calendar classes.
Update You can use the Joda library to do relative date and time calculations, like the one you need.
source share