--- title: "DAYSDIFF_MXONB(A)" slug: "engineeringdatefunction2-11" updated: 2021-10-16T10:30:24Z published: 2021-10-16T10:30:24Z canonical: "docs.datajet.app/engineeringdatefunction2-11" --- > ## 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. # DAYSDIFF_MXONB(A) ## Date Transform: DAYSDIFF_MXONB(A) ## Returns the number of days between Date A and the maximum value of Date B ## Purpose Use this function to calculate: - The number of days between a target date and a comparison date - The number of days between one event and most recent occurrence of another event - The age of a transaction in days relative to the total time covered by the data set ## Return Value | Property | Value | | --- | --- | | **FieldType** | Integer | | **FieldSize** | med | | **DataType** | Discrete | | **DataSize** | Short | ```shell Example Return Value: -N.....N where N is the maximum number of days between Date A and the maximum of Date B ``` ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/DAYSDIFF_MX_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”: “DAYSDIFF_MXONB(A,B)” | DAYSDIFF_MXONB(A,B) | | **A** | “p2”: “DateTimeFieldName” “p2”: “DateFieldName” “p2”: “#YYYY-MM-DD HH:MM:SS” “p2”: “#YYYY-MM-DD” | Required. Date to subtract from B. *Supports:* - **DataType:** Discrete / Continuous - **Field Type:** Date, DateTime - **Fixed Value:** #YYYY-MM-DD, e.g. #2021-04-05 - **Fixed Value:** #YYYY-MM-DD HH:MM:SS, e.g. #2021-04-05 11:01:08 | | **B** | “p3”: “DateTimeFieldName” “p3”: “DateFieldName” “p3”: “#YYYY-MM-DD HH:MM:SS” “p3”: “#YYYY-MM-DD” | Required. Date from which to calculate the maximum *Supports:* - **DataType:** Discrete / Continuous - **Field Type:** Date, DateTime - **Fixed Value:** #YYYY-MM-DD, e.g. #2021-04-05 - **Fixed Value:** #YYYY-MM-DD HH:MM:SS, e.g. #2021-04-05 11:01:08 | ## JSON Sample ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/DAYSDIFF_MX_JSON.PNG) ## Usage Notes See also [](https://datajet.document360.io/v1/docs/engineeringdatefunction2) - [ABSDAYSDIFF(A,B)](https://datajet.document360.io/v1/docs/engineeringdatefunction2) - Absolute difference in days between dates A and B - [DAYSDIFF(A,B)](/v1/docs/engineeringdatefunction2-10) - Difference in days between dates A and B - [DAYSBEFOREMAX(A)](/v1/docs/engineeringdatefunction2-9) - Difference in days between A and MAX(A) - [DAYSAFTERMIN(A)](/v1/docs/engineeringdatefunction2-8) - Difference in days between A and MIN(A) ## Example | Example | Details | | --- | --- | | **Description** | Calculate days between transaction and most recent response in the system | | **Input** | - Table: = [transactions] - Function: = DateTransform - **DateTimeFunction: =** - A:= [transactions].[date] - B: = [transactions].[last_response] - Name: = DaysDiffMaxOnLastResponse | | **Sample** | ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/DAYSDIFF_MX_Example.PNG) |