Age (Function) In french: Age Returns the age according to the date of birth. Versions 25 and later New in version 25
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).
Versions 24 and latera character string in YYYYMMDDHHMMSSCC format (YYYY corresponds to year, MM to month, DD to day, HH to hour, MM to minutes, SS to seconds and CC to hundredths of a second (use CCC for milliseconds). In this case, only the date is taken into account. New in version 24a character string in YYYYMMDDHHMMSSCC format (YYYY corresponds to year, MM to month, DD to day, HH to hour, MM to minutes, SS to seconds and CC to hundredths of a second (use CCC for milliseconds). In this case, only the date is taken into account. a character string in YYYYMMDDHHMMSSCC format (YYYY corresponds to year, MM to month, DD to day, HH to hour, MM to minutes, SS to seconds and CC to hundredths of a second (use CCC for milliseconds). In this case, only the date is taken into account. - a Date variable.
Versions 24 and latera DateTime variable. In this case, only the date is taken into account. New in version 24a DateTime variable. In this case, only the date is taken into account. a DateTime variable. In this case, only the date is taken into account.
<Calculation date>: Optional character string, Date or DateTime variable Date in relation to 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).
Versions 24 and latera character string in YYYYMMDDHHMMSSCC format (YYYY corresponds to year, MM to month, DD to day, HH to hour, MM to minutes, SS to seconds and CC to hundredths of a second (use CCC for milliseconds). In this case, only the date is taken into account. New in version 24a character string in YYYYMMDDHHMMSSCC format (YYYY corresponds to year, MM to month, DD to day, HH to hour, MM to minutes, SS to seconds and CC to hundredths of a second (use CCC for milliseconds). In this case, only the date is taken into account. a character string in YYYYMMDDHHMMSSCC format (YYYY corresponds to year, MM to month, DD to day, HH to hour, MM to minutes, SS to seconds and CC to hundredths of a second (use CCC for milliseconds). In this case, only the date is taken into account. - a Date variable.
Versions 24 and latera DateTime variable. In this case, only the date is taken into account. New in version 24a DateTime variable. In this case, only the date is taken into account. a DateTime variable. In this case, only the date is taken into account. If this parameter is not specified, today's 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.
|
Business / GUI classification : Neutral code
This page is also available for…
|
|
|
| |
| | Hoje is Date = DateSys() Nascimento is Date = EDT_T002_DATA_NASC d_minha_idade is Date = Age(Nascimento,Hoje) EDT_T002_DATA_NASC = d_minha_idade..Year |
|
|
|
| |
| |
| |
|
| | DIFERENCA_dATAS is Date=Age(EDT_data_inicial,EDT_data_Final)
EDT_DIA=DIFERENCA_dATAS..Day EDT_MES=DIFERENCA_dATAS..Month EDT_ANO=DIFERENCA_dATAS..Year
// BLOG COM VIDEO E EXEMPLOS
https://www.youtube.com/watch?v=KZfAotbawss
http://windevdesenvolvimento.blogspot.com.br/2017/09/aula-1266-datas-018-diferenca.html
|
|
|
|
| |
| |
| |
|
| | Exemplo Calcular Idade
d_data_nascimento is Date=EDT_data d_data_hoje is Date=DateSys() d_minha_idade is Date="" d_minha_idade=Age(d_data_nascimento,d_data_hoje) EDT_resultado=d_minha_idade..Year+" Anos "+d_minha_idade..Month+" Meses "+d_minha_idade..Day+" Dias"
//Blog com video e exemplo http://windevdesenvolvimento.blogspot.com.br/2016/07/curso-windev-datas-008-age-mostra-idade.html https://www.youtube.com/watch?v=92HZ0hql0m0
|
|
|
|
| |
| |
| |
| |
| |
| |
| | |
|