HOW TO
At times, it is necessary to remove the minutes and seconds recorded in the time field. However, rounding the time to the nearest hour is time-consuming if a large data is provided as shown in the image below. This is resolved by using an Arcade expression to populate the data in the attribute table. This article provides the workflow to round the time to the nearest hour using an Arcade expression in Portal for ArcGIS and ArcGIS Online Map Viewer.
Note: This workflow only applies to time data in a text field. For time data in a date field, use the Convert Time Field (Data Management) tool in ArcGIS Pro to convert the date field to a text field.
var t = ($feature.<TIME_FIELD>) var x = Iif (Minute(t) < 30, Hour(t), Hour(t) + 1) if(x == 24) { return 0 + ":00"; } else { return x + ":00"}
The image below shows the time rounded off to the nearest hour in the 24-hour time format in the Portal for ArcGIS attribute table.
Get help from ArcGIS experts
Download the Esri Support App