# Restrict specific day selection

**URL:** <https://forum.getodk.org/t/restrict-specific-day-selection/11233>\
**Category:** Support\
**Tags:** odk-xlsform\
**Created:** [January 2, 2018, 3:05pm UTC](https://forum.getodk.org/t/restrict-specific-day-selection/11233 "2018-01-02T15:05:41Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![LN](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ln/32/1605_2.png) [@LN](https://forum.getodk.org/u/LN)\
**Post date:** [January 2, 2018, 7:58pm UTC](https://forum.getodk.org/t/restrict-specific-day-selection/11233/3 "2018-01-02T19:58:33Z")

</div>

Ooh, this is a fun one 🎉. @A.N.M_AL-IMRAN is right that you could hard code the test for every individual Friday and Saturday but that sounds pretty tedious. Another approach is to use `decimal-date-time` which provides the number of days since January 1, 1970 UTC.

Your constraint would look something like:

```auto
int(decimal-date-time(.)) mod 7 != 1 
  and int(decimal-date-time(.)) mod 7 != 2

```

`mod 7` uses my favorite operator, the [modulus operator](https://en.wikipedia.org/wiki/Modulo_operation) to identify which of the 7 days this is. Jan 1, 1970 was a Thursday so Friday has an index of 1 and Saturday has an index of 2.

I don't think there needs to be any timezone adjustment thought it's possible there does. I'm also not sure the `int()` calls are needed but they shouldn't hurt. @ARIF_AZAD_KHAN could you give that a try and report your findings?

---

_[View the full topic](https://forum.getodk.org/t/restrict-specific-day-selection/11233)._
