# Date constraint for at least 15 days from today

698
5
03-29-2021 10:30 AM
New Contributor II

I need to add a constraint to a dateTime field that only allows a date that is at least 15 days after the submittal date.  I am trying to use this calculation:

.>=(today() + (1000 * 60 * 60 * 24 * 15))

but get a 'Please enter a valid value' message now when trying to enter ANY date.

Can anyway determine what I'm doing wrong?  I modified a formula in the Constraints section here:

https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformformulas.htm

Thanks!

1 Solution

Accepted Solutions
Regular Contributor

Have you taken a look at this Blog?

https://community.esri.com/t5/arcgis-survey123-blog/dates-and-time-in-survey123/ba-p/895528

I found it very useful when setting a calculation for 30 days past the user-inputted date.

Hope this helps

5 Replies
MVP Honored Contributor

This is what I use for 7 days.

\${CalibrationDate} < date(decimal-date-time(now()) -  7)

New Contributor II
Thanks, but unfortunately that did not work and I got the same error message again using any date. Is your field dateTime or just date?
MVP Honored Contributor

I looked again and I had that in a relevant.

My constraint is similar though

. < date(decimal-date-time(\${SondeDateTimeCollected}) +  1)

Mine is date.

I think I got this to work though

. > date(decimal-date-time(now() +  (1000 * 60 * 60 * 24 * 15)))

Hope that does it

Regular Contributor

Have you taken a look at this Blog?

https://community.esri.com/t5/arcgis-survey123-blog/dates-and-time-in-survey123/ba-p/895528

I found it very useful when setting a calculation for 30 days past the user-inputted date.

Hope this helps

New Contributor II
The blog was very helpful, thank you! This is what worked:

.> date(decimal-date-time(now()) + 15)