PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Returns the age according to the date of birth.
Example
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:
Calculating the date of Easter and an age 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.
Component: wd280std.dll
Minimum version required
  • Version 10
This page is also available for…
Comments
Click [Add] to post a comment