Create datetime from separate date and time fields

1017
3
05-03-2018 10:31 AM
MikeOnzay
Occasional Contributor III

I have separate date, time fields in a form that I want to concatenate into one datetime field. I'm following the suggestion that James wrote about in this post. I'm not using utcoffset.

datetime table

I don't know why I'm getting what looks like a date value between my date and time (shown in a note below). Appointment Time is a time field which is only supposed to store time as a string. I can see the string value in the validate input window in SurveyConnect.

datetime results

Tags (1)
0 Kudos
3 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Mike,

You'll need to apply date-format to the time question as well - times are internally representing as epoch time (milliseconds from 1/1/1970 00:00 UTC), which is what is being displayed. 

MikeOnzay
Occasional Contributor III

Still trying to understand this.

I thought that format-date and format-time is used convert to dates and times to text as you said in this post "The format-date function should not be used - that's for generating a human-readable string from a date". I thought that Time was stored as text according to the Dates and Time in Survey123 for ArcGIS blog. It doesn't make sense to me that I would need to use format-date on a time field that is already stored as text.

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Mike,

When time is written to the feature service, it is stored as text; while in the app, it is kept in the same data type as a date- this allows time calculations (i.e., 20 minutes into the future) to occur.

0 Kudos