--- title: "ANNIVERSARYDAYS(A,B)" slug: "engineeringdatefunction2-3" updated: 2021-10-14T10:46:20Z published: 2021-10-14T10:46:20Z canonical: "docs.datajet.app/engineeringdatefunction2-3" --- > ## 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. # ANNIVERSARYDAYS(A,B) ## Date Transform: ANNIVERSARYDAYS(A,B) ## Number of days between Day/Month(A) and Day/Month(B) as if A and B were both in the same year ANNIVERSARYDAYS(A,B) = DayOfYear(B) - DayOfYear(A) *where* DayOfYear(B) = number of days between B and the start of the year B DayOfYear(A) = number of days between A and the start of the year A ## Purpose Use this function to: - Calculate the number of days until a specific anniversary - Calculate the number of days past a specific anniversary ## Return Value | Property | Value | | --- | --- | | **FieldType** | Integer | | **FieldSize** | Low | | **DataType** | Discrete | | **DataSize** | Short | ```shell Example Return Value: -365....365 ``` ## ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/ANNIV_SAMPLE.PNG) ## Parameters | **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”: “ANNIVERSARYDAYS(A,B)” | ANNIVERSARYDAYS(A,B) | | **A** | “p2”: “DateField1” “p2”: “#YYYY-MM-DD” | Required. The comparative field. Supports: Date, DateTime, Fixed_Value Fixed Value = #YYYY-MM-DD e.g. #2021-04-05 | | **B** | “p3”: “DateField2” “p2”: “#YYYY-MM-DD” | Required. The anniversary field. 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/ANNIV_JSON.PNG) ## Usage Notes If DayOfYear(B) is **before** DayOfYear(A) then ANNIVERSARYDAYS(A,B) will be negative. If DayOfYear(B) is **after** DayOfYear(A) then ANNIVERSARYDAYS(A,B) will be positive. ## Example | Example | Details | | --- | --- | | **Description** | Days this year until anniversary of first transaction | | **Input** | - Table: = [customer] - Function: = DateTransform - **DateTimeFunction: = ANNIVERSARYDAYS(A,B)** - A:= #2023-01-01 - B: = [transactions].[first_transaction] - Name: = Anniversary2 | | **Sample** | ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/ANNIV_EXAMPLE.PNG) |