# Date constraint - Four weeks from todays date

**URL:** <https://forum.getodk.org/t/date-constraint-four-weeks-from-todays-date/35387>\
**Category:** Support\
**Tags:** form-design, odk-xlsform\
**Created:** [October 14, 2021, 7:47am UTC](https://forum.getodk.org/t/date-constraint-four-weeks-from-todays-date/35387 "2021-10-14T07:47:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bellbyrne](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/b/e79b87/32.png) [@bellbyrne](https://forum.getodk.org/u/bellbyrne)\
**Post date:** [October 14, 2021, 7:47am UTC](https://forum.getodk.org/t/date-constraint-four-weeks-from-todays-date/35387/1 "2021-10-14T07:47:45Z")

</div>

**1. What is the problem? Be very detailed.**  
I have added a constraint on date, so that entries more than 4 weeks from todays date can not go further in the form  
I have added this in the xlsx form in the constraint column as:  
int((today()-.) div 365.25) \<= 28

I do not receive any errors, and the form uploads fine, but when I test it, any date over or under 4 weeks is allowed through to the next group.

**2. What app or server are you using and on what device and operating system? Include version numbers.**  
ODK central

**3. What you have you tried to fix the problem?**  
I have also tried to add the constraint as one month:  
int((today()-.) div 365.25, ) \<= 0.1

But this has the same results

**4. What steps can we take to reproduce the problem?**  
I have attached my xlsx form

**5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.** [ODK\_test\_forum.xlsx](https://forum.getodk.org/uploads/short-url/1TSAwtfAe4V2z8Jl0Z56BDotzGO.xlsx) (16.3 KB)

---

<div class="post-metadata">

**Author:** ![Grzesiek2010](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/grzesiek2010/32/2881_2.png) [@Grzesiek2010](https://forum.getodk.org/u/Grzesiek2010)\
**Post date:** [October 19, 2021, 10:28am UTC](https://forum.getodk.org/t/date-constraint-four-weeks-from-todays-date/35387/2 "2021-10-19T10:28:25Z")

</div>

Hi @bellbyrne  
We're glad you're here. When you get a chance, please [introduce yourself on this forum thread](https://forum.getodk.org/t/-/6671). I'd also encourage you to add a real picture as your avatar because it helps build community!

As I said in [Want to select date of last six month from the current date including current date - #2 by Grzesiek2010](https://forum.getodk.org/t/want-to-select-date-of-last-six-month-from-the-current-date-including-current-date/31882/2)  
You need to use [decimal-date-time()](https://docs.getodk.org/form-operators-functions/#converting-dates-and-time) function. In your case it would be like:  
`. > decimal-date-time(today())-28`
