Hi
I am configuring a form in Field Maps and want to auto calculate the date so have chosen to use Now(), however this also adds a time. What do I need to add to this function so it only auto fills with a date not a time too?
Solved! Go to Solution.
While you wait for the DateOnly() function with to become available you can use the following:
Set the field's input type to "date" rather than the default "date and time". The user will then only see the date.
You can also use Today() instead of Now(). Today returns the current date at midnight, which is what will be stored in the database, but since you set the input type "Date" the user will of course only see the date.
Yeah I tried that - DateOnly() but it doesn't work. I get the following message:
Test execution error: Compilation error - Line : 1, 0: Function not found. Verify test data
Are you using Enterprise? This new capability was just released in v1.24 and is only available in ArcGIS Pro 3.2, ArcGIS Online, and ArcGIS Maps SDK for Javascript 4.28. If you're on AGOL, this should be available after tonight's upgrade.
All dates must have a time in Esri databases. New fields for date only are coming very soon (maybe last night?).
If you want to just not show the time you can try setting the popup in the map and it may use that in the form. It will still store a time. 123 does noon not sure on Field Maps. It often uses midnight which causes issues later with time zone conversions. So I just leave the time now.
While you wait for the DateOnly() function with to become available you can use the following:
Set the field's input type to "date" rather than the default "date and time". The user will then only see the date.
You can also use Today() instead of Now(). Today returns the current date at midnight, which is what will be stored in the database, but since you set the input type "Date" the user will of course only see the date.
I think this may default the time to midnight though. Then it may show the day before when using the value in a web map that is in a different timezone. Happens to me, esp with Alaska, and our users call about it.