Select to view content in your preferred language

dateTime now() not displaying the correct format

1237
4
Jump to solution
04-12-2023 08:16 PM
JoseBarrios1
Frequent Contributor

Hello everyone, 

I'm having hard time understanding how the dateTime format work is Survey123. I look at the this blog from Ismael (https://community.esri.com/t5/arcgis-survey123-blog/dates-and-time-in-survey123/ba-p/895528) but it is still not clear to me how to set the correct time format in the XLSForm (Connect . 3.17.55). For example, I want to display on the survey form and record the time as 10:40 PM (ET). If I set the dateTime default to now() it display the correct format  (see A red circle on image) but it records the time as 22:40.  Also, when I change the language to Spanish, the display also change to 22:40 (see B red circle on image). Any suggestions on how to accomplish this?  Thanks for  any help!

JBsurveyDate.png

 

0 Kudos
1 Solution

Accepted Solutions
IsmaelChivite
Esri Notable Contributor

Hi @JoseBarrios1 Unfortunately, it is not possible to use XLSForm syntax to define the time format to be used in the time widget. That is: You cannot control the format used to collect the date/time value in the calendar/time widget in the form.  The date and time format in the widget is dictated by the operating system and locale.

The format-date function is used to get a time value and generate a string, which you can then store as an attribute or display in the form as a note.

Your ask looks similar to this idea. https://community.esri.com/t5/arcgis-survey123-ideas/different-formats-for-time-field-in-survey123/i...  Feel free to add your input to the idea if appropriate. Thanks!

View solution in original post

0 Kudos
4 Replies
ChristopherCounsell
MVP Regular Contributor

Can you try forcing the date to be stored as 24 hour time from opening?

i.e.put the below into the default or calculation column for the survey_DateTime question?

format-date(now(),'%Y/%m/%d %H:%M')

I imagine it's to do with local device settings where the date is gettin gpulled from.

the notes will show in 24 hour time for both, as you have formatted them this way %:H = 24H

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

0 Kudos
JoseBarrios1
Frequent Contributor

Thanks magisian,

I try to set your formula on the default (and calculation ) for the dateTime question but it did not work for me. I'm getting a blank date and time for the default and an error on the calculation (see pic). Thanks once again for your feedback!

JB

Untitled-4.png

 

 

 

IsmaelChivite
Esri Notable Contributor

Hi @JoseBarrios1 Unfortunately, it is not possible to use XLSForm syntax to define the time format to be used in the time widget. That is: You cannot control the format used to collect the date/time value in the calendar/time widget in the form.  The date and time format in the widget is dictated by the operating system and locale.

The format-date function is used to get a time value and generate a string, which you can then store as an attribute or display in the form as a note.

Your ask looks similar to this idea. https://community.esri.com/t5/arcgis-survey123-ideas/different-formats-for-time-field-in-survey123/i...  Feel free to add your input to the idea if appropriate. Thanks!

0 Kudos
JoseBarrios1
Frequent Contributor

Go it...Thanks for your quick response! 

 

JB

0 Kudos