Calculates the difference in years between two date expressions.
Date1 | DateTime1 .Age([ ,Date2 | DateTime2 ])
Type Returned:
Numeric N(4)
Data Types: Date, DateTime
Generators:
.NET, Java, RPG, Cobol, Visual FoxPro (up to GeneXus X Evolution 3), Ruby (up to GeneXus X Evolution 3)
This method returns the difference in years between the two parameters (second parameter - first parameter).
The second parameter is optional. If it is omitted, the default value depends on the first parameter’s data type:
1. if it is of Date type, the default value is the one returned by the Today function.
2. if it is of DateTime type, the default value is the one returned by the Now function.
If the first parameter is less than the second parameter, the Age function returns a positive value. Otherwise, it returns a negative value.
&Nbr = &DateOfBirth.Age()
Age function