Age (Function) In french: Age Returns the age according to the date of birth.
Age("19690513", "20051010") // Returns "00360427" which means 36 years, 4 months and 27 days Age("19730912", "20050812") // Returns "00311100" which means 31 years and 11 months
// How old are you? dMyAge is Date dMyAge = Age("19790201", "20061025") InfoBuild("Your age is: %1 years %2 months %3 days", ... dMyAge.Year, dMyAge.Month, dMyAge.Day) // Displays: "Your age is: 27 years 08 months 24 days"
Syntax
<Result> = Age(<Date of birth> [, <Calculation date>])
<Result>: Character string - Age in years, months and days in YYYYMMDD format. It represents the number of years, months and days between the date of birth and the calculation date.
- Empty string ("") if an error occurred (date of birth after the calculation date or invalid date).
<Date of birth>: Character string, Date or DateTime variable Date of birth. This date can correspond to: - a character string in YYYYMMDD format (YYYY corresponds to the year, MM to the month and DD to the day).
- a character string in YYYYMMDDHHmmSSCC format (YYYY corresponds to the year, MM to the month, DD to the day, HH to hours, mm to minutes, SS to seconds and CC to hundredths of a second (use CCC for thousandths of a second)). In this case, only the date is taken into account.
- a Date variable.
- a DateTime variable. In this case, only the date is taken into account.
<Calculation date>: Optional character string, Date or DateTime variable Date from which the age is calculated. This date can correspond to: - a character string in YYYYMMDD format (YYYY corresponds to the year, MM to the month and DD to the day).
- a character string in YYYYMMDDHHmmSSCC format (YYYY corresponds to the year, MM to the month, DD to the day, HH to hours, mm to minutes, SS to seconds and CC to hundredths of a second (use CCC for thousandths of a second)). In this case, only the date is taken into account.
- a Date variable.
- a DateTime variable. In this case, only the date is taken into account.
If this parameter is not specified, the current date is used by default.
Related Examples:
|
Unit examples (WINDEV): Calculating the date of Easter and an age
[ + ] Calculating the date of Easter for a given year and calculating the age of a person at a given date.
|
This page is also available for…
|
|
|
|