Calculates the time difference between two dates.
unit (required) Unit to use for the difference. You can choose either “year”, “month”, “week”, “day”, “hour”, “minute”, or “second”.
start (required) The starting date.
end (required) The ending date.If end is before start the result is negative.
NOTE: The result is rounded to a whole number. If end is before start the result is negative.
DateDiff(“day”, [Invoice Date], Today())
- The time in days between the current UTC date and the Invoice Date.
DateDiff(“year”, [Invoice Date], Date(“2018-01-01”)) = 8
- The time, in years, from [Invoice Date] and January 1, 2018.
DateDiff(“hour”, [Ticket Date], Now()) = 103
- The time, in hours, from the Ticket Date to the current UTC date and time.
More About Date Functions
Date functions are useful for analyzing date input and extracting individual time components, like year or minute, from date objects.