Recently we did a review of the searches that have been entered into our website and noticed that someone was searching the site using the words “Elapsed Time”. When we saw this we assumed they were looking for a way to work out how long a survey has taken. So in this article we will look at some of the things that you can do record how long a survey takes. First off when an interview is started, the system being used be it Data Entry , Web , Cati or mobile stores the date and start time in a field called “Datacollection.StartTime” and when the interview is no longer active the finish date and time gets stored in a variable called “Datacollection.finishTime”. So to work out the total interview time all you have to do is to take the start time away from the finish time and you will get your answer. But how do you do this , well the best way is to use a command called datediff. A good way to see how datediff works is to open up your data in dmquery and then use this syntax on it.
select datacollection.starttime,datacollection.finishtime , datediff(datacollection.starttime,datacollection.finishtime,'s') as SurveyDuration from vdata
what this syntax does is to give us three columns of data , the fist is the start time followed by the finish time and then the difference between the two in seconds. As you can see the datediff command requires both dates and then a value to tell it what to return , in our example we wanted seconds , but you can have any of these values.
|“y”||Day of year (same as “d”)|
|“w”||Week (seven-day periods)|
|“ww”||Calendar weeks (using first-day-of-week setting from input locale)|
So that is how we work out the time in DMQuery , but how about if we wanted to do it in a DMS script so that the result is saved. Well first off we need a question to hold the answer in this example we are going to use a long as that is the datatype returned by DateDiff().
SurveyDuartion "Survey Duartion" long;
and then in our onnext case event we would have something like
SurveyDuartion = datediff(datacollection.starttime,datacollection.finishtime,'s')
So that is how we work out the full survey duration , but what if we want to record how long it takes to answer a set of question in the survey. This is really easy , just create the metadata to hold the information,
Section1Duartion "Survey Duartion" long;
and then at the start of the section store the section start time in a variable and at the end of the section work out the difference, for example,
Dim Section1StartTime .... Section1StartTime = now() ... The Section Questions Section1Duartion = datediff(Section1StartTime ,now(),'s')
And there you have it some simple
to get the numbers that you need. So if it was you that searched for this type of info on our website the hopefully this has helped, but if not let us know what you where after and we get the info to you. It does not hurt to ask.