Date AND Time Validation | XM Community
Skip to main content

Hello,

 

I need to add a validation to my survey and saw there are ‘Date format’ options under ‘Content type’; however, I’m looking to add date AND time validations to my question.  I’m assuming this is possible by creating a Custom Validation. If so, does anyone have any insight on how I may accomplish this?

Thank you!

@valdy34

Hi, if you are looking for date and time validation in single answer text entry can you let me know what date and time format are you looking for?

You can include Regex type custom validation based on it.


@valdy34

Hi, if you are looking for date and time validation in single answer text entry can you let me know what date and time format are you looking for?

You can include Regex type custom validation based on it.

mm/dd/yyyy, HH:MM XM

Thank you!


@valdy34

If you want in mm/dd/yyyy, HH:MM XM (AM PM) use below include it in Regex Custom Validation.

^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/\d{4}, (0[1-9]|1[0-2]):([0-5][0-9]) [APap][Mm]$

Hope it helps!


@valdy34

If you want in mm/dd/yyyy, HH:MM XM (AM PM) use below include it in Regex Custom Validation.

^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/\d{4}, (0[1-9]|1[0-2]):([0-5][0-9]) [APap][Mm]$

Hope it helps!

This did the trick! Thank you so much!


Hi Deepak,

Good day! Would you have a variation for time validation in 24-hr format? (e.g. 17:59)? Thanks in advance!

 

Best regards,

Philip 

 


@philipangwk 

Try this

^(?::01]\d|220-3])::0-5]\d$
 


Hi Deepak,

That was quick! Thank you so much!

A silly question here: Where do I add the Regex Custom Validation you very kindly suggested? Is it under JavaScript?

Thanks again!


@philipangwk 

Check this link

https://www.qualtrics.com/support/survey-platform/survey-module/editing-questions/validation/#CustomValidation


Hi Deepak,

Thanks for pointing me to the right place! I found where to add the regex validation now. What you suggested worked like a charm. Wonderful! Thanks again!

 

 


Deepak is the man!


Leave a Reply