AGE(A,B)
- 1 Minute to read
- Print
- DarkLight
- PDF
AGE(A,B)
- 1 Minute to read
- Print
- DarkLight
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
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 |
Example Return Value: -N....N where N is maximum number of years between Value(A) and Value (B)
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
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 |
|
Sample |
Was this article helpful?