get Age from LocalDate - Java java.time

Java examples for java.time:LocalDate

Description

get Age from LocalDate

Demo Code


//package com.java2s;
import java.time.LocalDate;
import java.time.Period;

public class Main {
    public static int getAge(LocalDate date1) {
        return Period.between(date1, LocalDate.now()).getYears();
    }//from  w w w.j  a  va  2 s .  c om
}

Related Tutorials