Select to view content in your preferred language

Date-Time Constraint

762
2
Jump to solution
10-09-2022 04:09 PM
GustavoAdolfoMartinezHincapie
Occasional Contributor

Hi, I have a survey that workers in the field must fill out every week (On Friday). So, every answer cover from Saturday to Friday

So I created two date-time questions with starting date and ending date.

The ending date question ends 6 days after the starting date. Problem is, I need the workers only can fill the starting date on Saturdays, I mean, the survey should show a warning if the workers mark the starting date a monday.

Help.

0 Kudos
1 Solution

Accepted Solutions
AndyMcClary
Regular Contributor

You can get the day of the week using format-date(${YOURDATEFIELD},'%a'). Depending on how you want the warning to appear you could either have a note field that warns your user, with relevant set to: format-date(${STARTDATE},'%a')!="Sat" or put format-date(${STARTDATE},'%a')="Sat" in the constraint column of your date field. 

View solution in original post

0 Kudos
2 Replies
AndyMcClary
Regular Contributor

You can get the day of the week using format-date(${YOURDATEFIELD},'%a'). Depending on how you want the warning to appear you could either have a note field that warns your user, with relevant set to: format-date(${STARTDATE},'%a')!="Sat" or put format-date(${STARTDATE},'%a')="Sat" in the constraint column of your date field. 

0 Kudos
GustavoAdolfoMartinezHincapie
Occasional Contributor

Thanks,

The issue was that following tutorial, I was writing the constraints in English; however, since my windows is in spanish, it is necessary to create the constraints in Spanish.

For example:

 Lun instead of Mon

Mar instead of Tue

And so on...

 

0 Kudos