HOW TO

Create a dynamic date range string in a layout in ArcGIS Pro using Arcade

Last Published: January 10, 2024

Summary

In an ArcGIS Pro page layout, a dynamic date range string can be used to provide context or information about the temporal extent of the data being presented. This is useful for time-aware layers or time series data.

This article describes the workflow to create a dynamic date range string in a layout in ArcGIS Pro using ArcGIS Arcade.

Procedure

Note: 
A map frame must be created before adding a layout. Refer to ArcGIS Pro: Add and modify map frames for more information.
  1. Open the project in ArcGIS Pro.
  2. Add a layout to the project. Refer to ArcGIS Pro: Create a blank layout for instructions.
  3. Add table dynamic text to the layout by choosing the Table Attribute group. Refer to ArcGIS Pro: Table dynamic text for instructions.
  4. In the Insert Table Attribute window, under Source, select the desired layer for Table.
  5. Under Query, select Custom Query from the drop-down menu.
  6. Under Appearance, click Expression to open the Expression Builder.
  7. Insert the following expression into the Expression box. Replace <numberOfDays> with the desired number.
Note:
•  To determine the date before the current date, specify a negative number for ''.
•  To determine the date after the current date, specify a positive number for ''.
var relDate = Now();
var start = DateAdd(relDate, <numberOfDays>, "days");
var end = DateAdd(relDate, <numberOfDays>, "days");

Text(start, 'M/D/Y') + ' to ' + Text(end, 'M/D/Y');

The following code block shows the full working script.

var relDate = Now();
var start = DateAdd(relDate, -8, "days");
var end = DateAdd(relDate, -2, "days");

Text(start, 'M/D/Y') + ' to ' + Text(end, 'M/D/Y');
  1. Click OK to close the Expression Builder.
  2. Click OK to close the Insert Table Attribute window.
  3. Drag a box into the desired location to create the dynamic text element in the layout view.

The map below shows the dynamic date range string is displayed.

Article ID: 000031729

Software:
  • ArcGIS Pro 3 1
  • ArcGIS Pro 3 0
  • ArcGIS Pro 3 2

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