date format in DD/MM/YYYY | XM Community
Skip to main content

HI I’m trying to add the date question and Qualtrics format US based. I’d like to change it to a DD-MM-YYYY format. Unfortunately the Java script does not make sense to me as I’m not a coder. can someone please help with the correct script?

Hi @mdaruka 

 

Can you show which question type you are using for the same?

If you are using the pre-built question types you can store dd mm yyy separately in an embedded data.


@Sowrabh1993 

thanks for the response. I am using the following script. But if this cannot be changed, happy to use the inbuilt question from Qualtrics. when a respondent selects the date it appears in the US format which we don’t want as it can confuse later. I want it to appear in the dd-mm-yyyy format

 

<link href="https://ajax.googleapis.com/ajax/libs/yui/2.9.0/build/calendar/assets/skins/sam/calendar.css" rel="stylesheet" type="text/css"/><script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/yui/2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/yui/2.9.0/build/calendar/calendar-min.js"></script> <script>Qualtrics.SurveyEngine.addOnload(function(){var qid =this.questionId;var calid = qid +'_cal';var y =QBuilder('div');
$(y).setStyle({clear:'both'});var d =QBuilder('div',{className:'yui-skin-sam'},mQBuilder('div',{id:calid}),
y
]);var c =this.questionContainer;
c = $(c).down('.QuestionText');
c.appendChild(d);var cal1 =new YAHOO.widget.Calendar(calid);
cal1.render();var input = $('QR~'+ qid);
$(input).setStyle({marginTop:'20px',width:'150px'});var p =$(input).up();var x =QBuilder('div');
$(x).setStyle({clear:'both'});
p.insert(x,{position:'before'});
cal1.selectEvent.subscribe(function(e,dates){var date = datesa0]s0];if(dated1]<10)
dated1]='0'+ dated1];if(dated2]<10)
dated2]='0'+ dated2];
input.value = dated1]+'-'+dated2]+'-'+dated0];})});</script>

hold on I got it! thanks :) 


Leave a Reply