Reformat Embedded Data When You Pipe Text into Question | XM Community
Skip to main content

I have an embedded data field pulling timestamp from the invite file in this format (2023-06-23 23:12:00) and I want to pipe it into a question just the date: Did you use internet on MM/DD/YYYY? I think I need javascript to convert the format and/or remove the time but all the examples I’ve found are solving way more complicated versions of this question -- any suggestions here?

Pipe the timestamp into a span:

<span class="formatDate">${e://Field/timestamp}</span>

Then use JS to modify:

Qualtrics.SurveyEngine.addOnload(function() {
var date = jQuery("#"+this.questionId+" .formatDate");
date.text(date.text().substr(0,10));
});

 


Thanks for the speedy response! So my question looks like the below but when I do preview (with an example timestamp included in the url: &timestamp=2023-06-23%2023:12:00) but all this span language appears verbatim in the preview. Did I mistype something?

and javascript like this: 

 


You need to be in HTML View to enter html in the question text.  When you type html into Normal view you get &lt;span... instead of <span...


That works, thank you!


Leave a Reply