Official Content

Calculates the difference, in years, between two date expressions.

Syntax

Age(Date-expression1 | DateTime-expression1 [ ,Date-expression2 | DateTime-expression2 ] )

Type returned:
Numeric(4)

Scope

Objects: ProcedureData Provider, Transaction, Web Panel Panel
Generators: .NET, .NET Framework, JavaApple, Android, Angular

Description

Returns the difference, in years, between the two parameters (second parameter - first parameter). If the second parameter, which is optional, is omitted, then the default value depends on the first parameter’s data type:

1.  If it is Date type, then the default value is the value returned by the Today function.
2.  If it is DateTime type, then the default value is the value returned by the Now function.

If the first parameter is prior to the second one, then Age function returns a positive value; otherwise, it returns a negative value.

Samples

&Nbr = Age(&DateOfBirth)

See Also

Age method

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant