Date constraint for at least 15 days from today

1213
5
Jump to solution
03-29-2021 10:30 AM
KellyDoss1
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!

0 Kudos
1 Solution

Accepted Solutions
AndrewBowne
Occasional Contributor III

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

View solution in original post

0 Kudos
5 Replies
DougBrowning
MVP Esteemed Contributor

This is what I use for 7 days.

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

0 Kudos
KellyDoss1
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?
0 Kudos
DougBrowning
MVP Esteemed 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

0 Kudos
AndrewBowne
Occasional Contributor III

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

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

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