get Age from Java LocalDate - Java Date Time

Java examples for Date Time:Duration

Description

get Age from Java LocalDate

Demo Code


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

import java.time.temporal.ChronoUnit;

public class Main {
    public static long getAge(LocalDate date) {
        return ChronoUnit.YEARS.between(date, LocalDate.now());
    }// w  w  w . jav  a 2  s .c  om
}

Related Tutorials