LocalDate today = LocalDate.now();
LocalDate birthday = LocalDate.of(1987, 09, 24);
Period period = Period.between(birthday, today);
//Now access the values as below
System.out.println(period.getDays());
System.out.println(period.getMonths());
System.out.println(period.getYears());
public int calculateAge(
LocalDate birthDate,
LocalDate currentDate) {
// validate inputs ...
return Period.between(birthDate, currentDate).getYears();
}