Java Calculate the age from the date of birth

www.la‮tu‬turi.com
Java Calculate the age from the date of birth
import java.time.LocalDate;
import java.time.Period;
public class AgeCalculator {
    public static void main(String[] args) {
        LocalDate birthDate = LocalDate.of(1995, 8, 21);
        LocalDate currentDate = LocalDate.now();
        Period age = Period.between(birthDate, currentDate);
        System.out.println("Age is: " + age.getYears() + " years, " + age.getMonths() + " months, and " + age.getDays() + " days");
    }
}
Created Time:2017-11-01 22:29:45  Author:lautturi