DateDiff()

Returns the difference between two dates or times.

Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes

This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0).

The DateDiff() function has three parameters.

  • startDate (date): Required. The starting date for the comparison.
  • endDate (date): Required. The end date for the comparison. The function subtracts the startDate from the endDate.
  • unitOfDifference (string): Required. The unit of time difference to return. Accepted values: Y (years), M (months), D (days), H (hours), and MI (minutes).

This example adds one day to the current timestamp, and then uses the DateDiff() function to calculate the number of minutes until the new date. The example assumes that the current timestamp is 2024-08-04T13:41:23Z.

The function outputs the number of minutes until 1 day from the current date.