HOW TO

Display date fields in labels without timestamps using Arcade in ArcGIS Online and Portal for ArcGIS Map Viewer

Last Published: May 9, 2023

Summary

In ArcGIS Online and Portal for ArcGIS Map Viewer, when displaying a date field as labels, the timestamps can be removed using an Arcade expression. This is useful when displaying a date field without timestamps while retaining the timestamps in the attribute table.

In this example, the date field used is named ‘TestDate'. The image below shows labels displaying the date field with timestamps on the web map.

Web map displaying date field labels with timestamps

Procedure

  1. Open the web map in Map Viewer.
  2. On the Settings (light) toolbar, click Labels Label icon. Ensure labels are enabled by toggling on the Enable labels option.
  3. In the Label features pane, click Add label class. Under Label field, click Use expression Use expression icon.
  4. In the editor window, configure the expression below. Replace <field_name> with the name of the date field to be displayed as labels.
Note: 
The format of the dates can be configured as per preference. In this example, the date format used is Y-MM-DD.
Text($feature.<field_name>, 'Y-MM-DD')
  1. Click Done in ArcGIS Online Map Viewer or OK in Portal for ArcGIS Map Viewer.
Expression specified in the code box

The image below shows labels displaying the date field without timestamps on the web map.

Date field labels without timestamps

Article ID: 000030241

Software:
  • ArcGIS Online
  • Portal for ArcGIS

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options