Display block after specific time | XM Community
Skip to main content
Hello. I'm new to the forum here, so I hope I'm in the right place! I'm running a survey in which respondents can only view a specific block AFTER a certain time (e.g., 10pm, Eastern time). I'd like to kick them off of their current block at that time and begin the new block. I know that there are some experts here, so I bet there are more creative and feasible solutions to what I'm thinking of doing--my first thought was to use embedded data for the current time, and display the block only if the current time is greater than 10:00pm. Unfortunately I can't find a way to do this. Any suggestions? Thanks in advance!
Hi @brianmguay



Paste the below code in the "onReady" section of JavaScript



var offset = -4.0

var clientDate = new Date();

var utc = clientDate.getTime() + (clientDate.getTimezoneOffset() * 60000);

var serverDate = new Date(utc + (3600000*offset));

var timecap = serverDate.toLocaleString();

var d = new Date(timecap);

var gethour = d.getHours();

Qualtrics.SurveyEngine.setEmbeddedData("Currenthour",gethour);



Then, create an embedded data "Currenthour" in survey flow and utilize "Currenthour" embedded data to apply your logic. This is only capturing the hour in EST timezone.
Thanks @Mohammedali_Rajapakar_Ugam !

Leave a Reply