Conditional Logic with Date and Time in Qualtrics

If your survey requires special rules based on date, time, or day of the week, this article will introduce you to the controls you can use to make that happen.  

Before You Start 

You will need a Qualtrics account before you can complete this task.

The Basic Elements

Branching on date or time is not supported by any single Qualtrics control. By using a few controls together, we can build one.  The building blocks we will use include:

  1. Survey Flow (Overview)
  2. Embedded Data (Setting Setting Values in the Survey Flow)
  3. Piped Text (Piping Date and Time) 
  4. Branch Logic (Overview)

Combining Elements to Control Block Display

We will start putting the above together by editing a survey that contains at least two Blocks. Note that Block display is just one application of using logic in a Qualtrics survey—much of this can apply wherever you use conditional logic.  

Case Examples

There are several use cases for this block in surveys.

Case 1: Day of the Week

With a few small changes the instructions above can be adapted to control display on a day of the week. Let's say for example, you want to prevent participants from responding to your survey on weekends. 

Case 2: Before or After a Date

It may be more useful to display a Block in your survey before or after some date, rather than just on the day itself. That's easily done by editing your Branch logic to use Is Greater Than or Is Less Than instead of just Equals. To be safe when doing this sort of comparison, we recommend defining the Variable Type of your Embedded Data. 

Case 3: Time of Day

You can also use Is Greater Than or Is Less Than with time of day. In this example we will customize a greeting to read "Good Morning," "Good Afternoon," or "Good Evening." Instead of Blocks, here we will demonstrate using Display Logic in the survey question editor. 

As an exercise, can you think of a way using Embedded Data, Branching, and Piped Text to tailor a greeting like this without creating three separate questions? Remember that you can pipe text from Embedded Data into survey questions.  

Time Zones

All of the above examples will use the time zone setting of your Qualtrics account. This means that the time displayed may not match the time at your respondent's location. To get the actual time at any location, you would need to use JavaScript to query time of day from the browser. 

Questions?

This method lends itself to lots of applications in your survey logic. If you have any questions, email us at the address below. 

Email: research-programming@wharton.upenn.edu