Select to view content in your preferred language

Assistance needed: Converting time to decimal-date time

689
5
02-28-2024 11:11 PM
JoseBarrios1
Frequent Contributor

Hello,

"I need assistance converting time to decimal-date time for the web. I'm utilizing pulldata @layer> function to retrieve the CreationDate value from the feature service. Despite several attempts over many hours, I'm only getting 13-digit number (likely a Unix timestamp). This is the expression that is producing the unexpected result (1708698560480) instead of the expected '2/22/2024 9:40 AM'."

date-time(decimal-date-time(int(pulldata("@layer","getValue","attributes.CreationDate","https://services.arcgis.com/______results/FeatureServer/0?orderByFields=CreationDate DESC",concat("nestZoneKey='", ${nest_ZoneKey}, "'")))))

Thanks for any help!

JB

5 Replies
abureaux
MVP Frequent Contributor

If you feed that value into a data/dateTime question in S123, it should convert it for you. UNIX time is how all dates/datetimes in S123 are stored.

There is a Sample Survey that deals with dates and times.

 

EDIT: Technically unrelated to this post, but there is a good chance someone may stumble across this post looking for external applications... If you are working with S123's date/datetime in any external application (e.g., Power Automate), you do need to convert it. In Power Automate, you do so via:

addseconds('1970-1-1', Div(${s123_date_question},1000) , 'yyyy-MM-dd')

 

0 Kudos
JoseBarrios1
Frequent Contributor

Hello abureaux,

Thank you for the suggestion!

The expression is already configured for a dateTime question (refer to the image below). I've reviewed the survey samples, but I'm still unable to determine what I might be missing.

Date_error.png

 

 

 

0 Kudos
abureaux
MVP Frequent Contributor

My bad. Yes, that is the proper configuration. Seems like a Web App limitation. I tend to avoid the Web App unless absolutely mandatory.

Here is an article that may help (they are working with web forms).

0 Kudos
DougBrowning
MVP Esteemed Contributor

pulldata does not like being nested in anything in the web form.  Move the pulldata to its own field then use that field in your calc above.  That should be it.

EricaNova
Frequent Contributor

Nothing seems to work for me here (on the web app). 

0 Kudos