PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Returns the age according to the date of birth.
Versions 16 and later
Universal Windows 10 App This function is now available for Windows Phone applications.
New in version 16
Universal Windows 10 App This function is now available for Windows Phone applications.
Universal Windows 10 App This function is now available for Windows Phone applications.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Versions 25 and later
WEBDEV - Browser code This function is now available in browser code.
New in version 25
WEBDEV - Browser code This function is now available in browser code.
WEBDEV - Browser code This function is now available in browser code.
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).
  • Versions 24 and later
    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.
    New in version 24
    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 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 later
    a DateTime variable. In this case, only the date is taken into account.
    New in version 24
    a 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 later
    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.
    New in version 24
    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 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 later
    a DateTime variable. In this case, only the date is taken into account.
    New in version 24
    a 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:
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.
Business / GUI classification : Neutral code
Component : wd250std.dll
Minimum version required
  • Version 10
This page is also available for…
Comments
Idade
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
BOLLER
30 Nov. 2019
DIFERENCA ENTRE DATAS
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




De matos
30 Sep. 2017
Exemplo Calcular Idade
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



De matos AMARILDO
22 Jul. 2016