Package javatapas.util
Class GetAgeFromBirthDate
java.lang.Object
javatapas.util.GetAgeFromBirthDate
public class GetAgeFromBirthDate extends Object
Get the age of a person from their birth date.
Published at https://www.javatapas.com/util/Java-Get-Age-From-Birth-Date.html
Javadoc at https://www.javatapas.com/docs/javatapas/util/GetAgeFromBirthDate.html
Published at https://www.javatapas.com/util/Java-Get-Age-From-Birth-Date.html
Javadoc at https://www.javatapas.com/docs/javatapas/util/GetAgeFromBirthDate.html
- Version:
- 2021-05-27
- Author:
- Kodiak Brown
-
Constructor Summary
Constructors Constructor Description GetAgeFromBirthDate()
-
Method Summary
Modifier and Type Method Description static int
getAgeFromBirthDate(int birthDay, int birthMonth, int birthYear)
Calculate the Age in Years as of right now given a Birth Date.static int
getAgeFromBirthDate(Calendar birthDate)
Calculate the Age in Years as of right now given a Birth Date.static int
getAgeFromBirthDate(Calendar birthDate, Calendar refDate)
Calculate the Age in Years given a Birth Date and a Reference Date
-
Constructor Details
-
GetAgeFromBirthDate
public GetAgeFromBirthDate()
-
-
Method Details
-
getAgeFromBirthDate
Calculate the Age in Years given a Birth Date and a Reference Date- Parameters:
birthDate
- The birth date of a person, place or thing.refDate
- The reference date from the which the age should be calculated from. To get the age of something in 10 years, the reference date should be a Calendar object created from today's date plus 10 years.- Returns:
- The Age in Years.
-
getAgeFromBirthDate
Calculate the Age in Years as of right now given a Birth Date. The reference date is the time/date at the time when this method is called.- Parameters:
birthDate
- The birth date of a person, place or thing.- Returns:
- The Age in Years.
-
getAgeFromBirthDate
public static int getAgeFromBirthDate(int birthDay, int birthMonth, int birthYear)Calculate the Age in Years as of right now given a Birth Date. The birth date is represented as Day, Month and Year integers.- Parameters:
birthDay
- The numeric day of the month the person/place/thing was born on.birthMonth
- The numeric month the person/place/thing was born in.birthYear
- The year the person/place/thing was born in.- Returns:
- The Age in Years.
-