HOW TO
In Portal for ArcGIS, date attributes displayed in pop-ups in Map Viewer are by default in the UTC time zone. However, it is possible to customize the pop-up display to project dates in the local machine time zone. This article provides instructions to customize a pop-up to display data from a related table and date field value as per the local machine time zone using Arcade Expression in Portal for ArcGIS Map Viewer.



var <variableName1> = OrderBy(FeatureSetByName(<inputFeature>,"<relationshipName>"), "<fieldName1>");
var <variableName2> = Count(<variableName1>);
var <variableName3> = "";
if (<variableName2> > 0) {
var <variableName4> = First(<variableName1>);
<variableName3> = $feature["<fieldName2>"] + " " + Text(ToLocal($feature["fieldName1"]), "<dateFormat> <timeFormat>");
}
return relatedinfo;

The following code block demonstrates the full working expression.
var relatedrecords = OrderBy(FeatureSetByName($map,"202108_Capital_Projects - Capital_Projects_Q2_2021_All"), "ACTUAL_START_DATE_UTC");
var cnt = Count(relatedrecords);
var relatedinfo = "";
if (cnt > 0) {
var info = First(relatedrecords);
relatedinfo = $feature["PROJECT_PHASE"] + " " + Text(ToLocal($feature["ACTUAL_START_DATE_UTC"]), "D/M/Y h:MM A");
}
return relatedinfo;



The image below shows the CONVERT_ACTUAL_START_DATE_UTC field with the project phase, date, and time values after using the Arcade expression.

Article ID: 000027918
Get help from ArcGIS experts
Start chatting now