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 ;-)):
With Java 8, we can calculate a person age with one line of code:
public int calCAge(int year, int month,int days){ return LocalDate.now().minus(Period.of(year, month, days)).getYear(); }