Calculating the difference between two date/time fields

To calculate the difference between two date/time fields, create hidden fields that convert the time/date values gathered by time/date fields into a specific format using FORMAT-DATE. Then create another hidden or visible field with a dynamic value that uses the DATEDIFF function to calculate the difference between the two hidden fields.

In the below example, {{timeDiff}} is formatted with 'HH' to show hours. This can be modified to show the time difference in another format, such as hours and minutes, etc. Please see this article for more detail on data/time format codes.

startTimeHidden:
FORMAT-DATE({{startTime}}, 'yyyy-MM-dd HH:mm:ss')

endTimeHidden:
FORMAT-DATE({{endTime}}, 'yyyy-MM-dd HH:mm:ss')

timeDiff:
DATEDIFF({{StartTimehidden}}, {{EndTimeHidden}}, 'HH')

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.