Select to view content in your preferred language

Struggling with Time Stamps in Arcade

239
0
12-14-2023 09:21 AM
JeffSilberberg
Occasional Contributor III

I have a situation where I am struggling with time stamps.  Specifically, I have a Velocity Feed that contains Unix Time of an event.  I am converting as recommended with the expression: round(eventTimeUnix*1000).  I can also now use some of the Date functions to output this in readable form in Popup. 

var event_time = Date($feature.eventTimeUnix);
var transaction_time = ChangeTimeZone(event_time, "America/Denver");

But what I can't seem to do is output the value as a numeric string so I can put it into a JSON object.  

{"report_id": 122344, "EventTime" : $feature.eventTimeUnix}  It tries to format this as a DateTime stamp. Does anyone have any suggestions on how to proceed?  Been looking here and here but still at a loss.  Specifically at the text() function. 

https://developers.arcgis.com/arcade/function-reference/date_functions/

https://developers.arcgis.com/arcade/function-reference/text_functions/

https://developers.arcgis.com/arcade/function-reference/text_functions/#text

By the way, the Z formatting option also does not seem to work as ZZZ or zzz just gets printed as characters in the resulting text string. 

text(transaction_time,'dddd, MMMM D, Y @ H:mm:ss ZZZZ');

 

 

 

Tags (1)
0 Kudos
0 Replies