Select to view content in your preferred language

Get date value from end field

426
4
11-27-2023 08:24 AM
GregKeith
Occasional Contributor III

Howdy!

I'm using Survey123 Connect v. 3.19, Enterprise 10.9. I'm trying to calculate just the date value, as a date type, from the 'end' question type (named end_date), but not having any luck.

I can get it as a string value using format-date(${end_date}, "%Y-%m-%d"), but I need a date value. Wrapping the format-date function in date() gives me a date, but with time as well. If I use just ${end_date} in the calculation, I get the epoch date format, ex. 1701102066.

Is there a way to do this, or am I stuck with the time value as well? Thanks!

0 Kudos
4 Replies
abureaux
MVP Regular Contributor

Where are you using this date value? If it is inside of the Esri environment, I feel like the addition of time is something new. We have a date only field that time is being annoying injected into. But in our case, things worked fine in 10.9, but started acting up in 11.0.

If this is some other database, your format-date() should be enough. I regularly dump data like that into SharePoint without issue (A formatted date, not Esri's Epoch date. That requires converting in Power Automate first).

I assume you are using a date field?
abureaux_0-1701116537038.png

 

0 Kudos
GregKeith
Occasional Contributor III

Thanks @abureaux . Currently trying a hidden field type, esriFieldTypeDate. Format-date gives me a text value in the correct format, but I want an actual plain date value data type. I can live without it, but would prefer it.

GregKeith_0-1701190834259.png

 

0 Kudos
abureaux
MVP Regular Contributor

Have you tried type = date and appearance = hidden? The server may interpret that better.

GregKeith
Occasional Contributor III

I'll give that a try. In general, don't like hidden appearance because it still takes up space on the form, but since it's at the end it may not matter.

Edit: still shows time. Not actual time, defaults to 12:00 pm. Oh well.

0 Kudos