dateDiff

Use the dateDiff function to calculate the difference in time between two DateTime values. The difference in time can be calculated in years, months, days, hours, minutes, or seconds and the function returns the calculation as an Integer value.

Function format

dateDiff(Text date unit type, DateTime start, DateTime end)

  • date unit type: the type of date unit to calculate the difference in. Specify TotalYears, TotalMonths, TotalDays, TotalHours, TotalMinutes, or TotalSeconds.
  • start: the first date value used in the calculation.
  • end: the second date value used in the calculation.

dateDiff example

The example formula contains two DateTime form variables:

  • Form.Start date: 14 Oct 2018
  • Form. End date: 18 Oct 2018

dateDiff("TotalDays", Form.Start date,Form.End date)

The function in this formula returns the Integer value 4.