TIMESTAMPADD
This function adds a specified date/time interval to given date field or expression. The interval timeframe can be changed depending on the fields need.
TIMESTAMPADD( <Interval>, <Interval_Value>, <Field or Timestamp>)Description
- Interval: The timeframe used to measure the time difference between each timestamp/date.
- SQL_TSI_FRAC_SECOND: Difference returned in Milliseconds
- SQL_TSI_SECOND: Difference returned in Seconds
- SQL_TSI_MINUTE: Difference returned in Minutes
- SQL_TSI_HOUR: Difference returned in Hours
- SQL_TSI_DAY: Difference returned in Days
- SQL_TSI_WEEK: Difference returned in Weeks
- SQL_TSI_MONTH: Difference returned in Months
- SQL_TSI_QUARTER: Difference returned in Quarters
- SQL_TSI_YEAR: Difference returned in Years
- Interval_Value: The amount of time to add, dependant on which Interval Timeframe has been selected. (eg Hours, Days, Weeks).
- Field or Timestamp: The Timestamp (Date / Time) to be used in the Calculation.
Note: dates in Audiences need to be formatted as either YYYY-MM-DD or MM/DD/YYYY. Entering a date as 01-02-2023 would be read as Jan-2 not 1-Feb.
Example: create a field which calculates a transaction’s follow up date, 14 days after the original Transaction Order date was made.
TIMESTAMPADD( SQL_TSI_DAY, 14 , [Transaction.Order Date])
Result:
- Returns a follow up date of 02/22/2024 for an order date of 02/08/2024
- Returns a follow up date of 11//052024 for an order date of 10/22/2024
- Returns a follow up date of 01/20/2025 for an order date of 01/06/2025
- Returns a follow up date of 08/17/2024 for an order date of 08/03/2024