HOW TO

Add AM or PM in a web map pop-up

Last Published: April 25, 2020

Summary

Date and time values can be included in a web map pop-up. However by default, the time (which displays in a 12-hour time format) does not include AM or PM indicators. This may be confusing for viewers when trying to determine in which half of the day an event occurred.

The image below shows a pop-up in the Portal for ArcGIS Map Viewer where time is displayed without AM or PM.

The date formatting does not add automatically the AM or PM at the end

AM or PM indicators can be included using an Arcade expression. This is possible using ArcGIS Arcade Text Functions to specify the desired format for dates and time to be displayed in the pop-up.

Procedure

The following steps describe how to add the Arcade expression to the pop-up in a web map:

  1. Configure pop-ups in ArcGIS Online or a web map.
  2. In the Configure Pop-up side console, scroll to Attribute Expressions and click ADD.
  1. Type the expression in the Attribute Expression text box and click OK to execute the expression.

    The following is the Arcade expression used to add AM or PM in the web map pop-up. If the hour is more than 12, PM is returned, or else, AM is returned.

var n = Date(2018,04,24,05,09); Text(n,'M/DD/YY, hh:mm A')
The expression is used to add AM or PM in the web map pop-up

The following image shows AM added at the end of the time in the web map pop-up according to the steps above.

AM added at the end in the pop-up

Article ID: 000018309

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