I want to return an age in years as an int in a Java method. What I have now is the following where getBirthDate() returns a Date object (with the birth date ;-)):
Easiest way without any libraries:
long today = new Date().getTime(); long diff = today - birth; long age = diff / DateUtils.YEAR_IN_MILLIS;