DAYSDIFF(A,B)
  • 1 Minute to read
  • Dark
    Light
  • PDF

DAYSDIFF(A,B)

  • Dark
    Light
  • PDF

Article summary

Date Transform: DAYSDIFF(A,B)

Returns the number of days difference between two dates, where A is taken away from B

DAYSDIFF(A,B) = B - A

Purpose

Use this function to calculate:
  • The number of days between two dates
  • The elapsed time in days between two time-stamps
  • The amount of time between an event and a specific date

Return Value

PropertyValue
FieldTypeInteger
FieldSizeMed
DataTypeDiscrete
DataSizeShort


Example Return Value: -N to N 
where 
N is the maximum difference between dates for any individual record
N is an integer

Parameters

ParameterJSONDescription
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(A,B)”DAYSDIFF(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. Comparator Date.
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

Usage Notes

The order in which fields A and B are specified will affect the value of DAYSDIFF(A,B)

See also ABSDAYSDIFF(A,B)

Example

ExampleDetails
DescriptionCalculate the number of days between Purchase and Shipping
Input
  • Table: = [transactions]
  • Function: = DateTransform
  • DateTimeFunction: = DAYSDIFF(A,B)
  • A:= [transactions].[dtShipping]
  • B: = [transactions].[dtPurchase] 
  • Name: =DaysDiff
Sample



Was this article helpful?