Java LocalDate Calculate calculateAge(LocalDate birthDate, LocalDate currentDate)

Here you can find the source of calculateAge(LocalDate birthDate, LocalDate currentDate)

Description

calculate Age

License

Open Source License

Declaration

public static int calculateAge(LocalDate birthDate, LocalDate currentDate) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.time.LocalDate;

import java.time.Period;

public class Main {
    public static int calculateAge(LocalDate birthDate, LocalDate currentDate) {
        if ((birthDate != null) && (currentDate != null)) {
            return Period.between(birthDate, currentDate).getYears();
        } else {/*  w  w  w  .ja v a2  s.c  om*/
            return 0;
        }
    }
}

Related

  1. asDate(LocalDate date)
  2. asEpochMilli(final LocalDate localDate)
  3. atEndOfDay(LocalDate date)
  4. before(final LocalDate d1, final LocalDate d2)
  5. calcNextDayOfWeek(LocalDate d, DayOfWeek dow)
  6. changeDateToLocalDate(Date value)
  7. convert(LocalDate ld)
  8. convertDatabaseDateToUS(LocalDate databaseDate)
  9. converterToLocalDate(final String date)