How do I create a piped text that automatically inputs the date 90 days in the past? | XM Community
Skip to main content
Hello all,



I am currently converting a measure to an online version via Qualtrics. This measure requires a participant to think about an event on a date 1 month in the past, 90 days in the past, and 12 months in the past. I can create the 1 month and 12 month anchors easily using the piped text options. However, the 90 day anchor is not as clear. Is there some sort of piped text coding I can create so that it automatically fills in the exact date 90 days ago?



Precisely, I want it to look like this:



"Next, we'll establish a 90-day anchor date. Do you recall anything that was happening on [90-day anchor date]?"



Thank you so much!

Neil
${date://OtherDate/m%2Fd%2FY/-90 day}
You are the BEST, Tom! This worked perfectly.

Hi, is there a way to used piped text to populate a date that is 30 days from a date entered on an existing field in the survey? We have a start date field, and the respondent is expected to enter a specific date in that start date field, we then want to populate the end date to reflect +30 from the start date. We then want to continue using piped text for all subsequent questions after the start and end date fields so that the start and end dates are shown within the subsequent questions question text. For example, if i enter 8/01/2020 as the start date, the end date should populate as 8/31/2020 and then the types of questions we have where we want this date range populated are in the format of, "In these past 30 days ( to ) how often have you..."
Is this possible to implement through piped text and without javascript?
I have tried using ${date://OtherDate/m%2Fd%2FY/+30 day} but it only references today's date. I have tried using different piped text with embedded data fields- it feels like I am so close to figuring this out yet so far away. Any help/input is appreciated.
Thanks!
Rebecca


https://www.qualtrics.com/community/discussion/comment/30145#Comment_30145Unfortunately, you can only pipe dates based off the current date. The only possible work around using piped text would be if you had a fixed day (e.g. the 1st), then you can do "OtherDate" calculations off year (Y), month (m), and day (d) separately then concatenate the results.
You'll probably need to use JavaScript. If you do, I recommend using moment.js to do date calculations.


TomG thanks for the quick reply!! would you happen to have an example off hand of the javascript code that could work for my scenario above? I had come across the moment.js page and unfortunately am not very JS savvy, but have other programmers on my end I can follow-up with as needed.


The following is pretty close, you just need to add 30 days instead of subtract 2 weeks:
https://www.qualtrics.com/community/discussion/comment/7047#Comment_7047


Leave a Reply