--- title: "AGE(A,B)" slug: "engineeringdatefunction2-2" updated: 2021-10-14T10:20:40Z published: 2021-10-14T10:20:40Z canonical: "docs.datajet.app/engineeringdatefunction2-2" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.datajet.app/llms.txt > Use this file to discover all available pages before exploring further. # AGE(A,B) ## Date Transform: AGE(A,B) ## Number of whole years between the dates represented by A and B AGE(A,B) = B - A ## Purpose Use this function to: - Calculate the age of a customer at a specific point in time - Calculate the age of a transaction at a specific point in time - Calculate the number of whole years between two dates ## Return Value | Property | Value | | --- | --- | | **FieldType** | Integer | | **FieldSize** | Low / Med | | **DataType** | Discrete | | **DataSize** | Short | ```shell Example Return Value: -N....N where N is maximum number of years between Value(A) and Value (B) ``` ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/AGE_AB_Sample.PNG) ## Parameters | Parameter | JSON | Description | | --- | --- | --- | | **Table** | “targetTable”: “MyTableName” | The target table on which the new field will be created | | **Filter** | “dataset”: {DataSet_JSON} | Optional. If a filter is applied, records not in the filter Recordset will be returned as null. | | **DateTimeFunction** | “p1”: “AGE(A,B)” | AGE(A,B) | | **A** | “p2”: “DateField1Name” “p2”: “#YYYY-MM-DD” | Required. Supports: Date, DateTime, Fixed Value. Fixed Value = #YYYY-MM-DD e.g. #2021-04-05 | | **B** | “p3”: “DateFieldOrValue2” “p3”: “#YYYY-MM-DD” | Required. Supports: Date, DateTime, Fixed Value. Fixed Value = #YYYY-MM-DD e.g. #2021-04-05 | ## JSON Sample ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/AGE_AB_JSON.PNG) ## Usage Notes To calculate current age, use the AGE(A) function. Use AGE(A,B) to calculate age in years between two fixed dates. The number of years is calculated **FROM** B **TO** A. ## Example | Example | Details | | --- | --- | | **Description** | Calculate transaction age on a specific day | | **Input** | - Table: = [transactions] - Function: = DateTransform - **DateTimeFunction: = AGE(A,B)** - A:= [transactions].[date] - B: = #2022-01-01 - Name: =AgeIn2022 | | **Sample** | ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/AGE_AB_Example.PNG) |