import java.time.LocalDate;
import java.time.Period;
class TestJava {
public static void main(String[] args) {
LocalDate currentDate = LocalDate.now();
LocalDate birthDay = LocalDate.of(1989, 2, 22);
Period period = Period.between(birthDay, currentDate);
System.out.println("Age: ");
System.out.println("Years: " + period.getYears());
System.out.println("Months: " + period.getMonths());
System.out.println("Days: " + period.getDays());
}
}
Output:
Age: Years: 32 Months: 11 Days: 2