logo SmartSurvey / Scripting Docs
Back to Docs
Built-in Function
timediffof[Qa,Qb] Date/Time

Returns the difference in minutes between two time question responses (Qb − Qa). Used to measure interview duration by placing *TIME questions at the start and end of the questionnaire.

Parameters
Parameter Type Description
Qa Question ref First time question (the earlier time)
Qb Question ref Second time question (the later time)
Returns: Integer — difference in minutes (Qb minus Qa)
Examples
expressions
timediffof[Q15,Q16]>=10    -- interview lasted at least 10 minutes
timediffof[Q15,Q16]<=60    -- interview under one hour
timediffof[Q15,Q16]=0      -- both timestamps identical
Returns a positive integer when Qb is later than Qa. May return negative if times cross midnight.
Use in quality control to flag interviews completed too quickly (possible speeders).
Related