HOW TO

Symbolize a range of dates using Arcade in ArcGIS Pro

Last Published: September 2, 2021

Summary

A range of dates can be symbolized to represent areas that have and have not been surveyed for a particular period. Arcade functions such as DateDiff(), Date() and Now() can be used to isolate and symbolize specific ranges in a Date data type field.

The following image shows a study of wilderness areas in Utah, U.S. The attribute table shows the survey dates for each area.

Image of the Bear_Survey_Area
Image of the survey dates.

This article describes the workflow to symbolize the areas according to three date ranges: areas surveyed in the last 30 days, areas surveyed in more than 30 days and less than 100 days, and areas surveyed in more than 100 days.

Procedure

The following instructions describe how to symbolize the range of dates using Arcade in ArcGIS Pro.

Displaying the date ranges in 30 days, more than 30 days and less than 100 days

  1. In ArcGIS Pro, right-click the layer in Contents and click Symbology.
  2. In the Symbology pane, select Unique Value from the Primary symbology drop-down list.
  3. Click the button next to the Field 1 drop-down field to set an expression.
Image of the Expression Builder - Arcade
  1. In the Expression Builder dialog box, use the following expression:
Note:
Ensure the field used to calculate the range of dates is in Date data type.
//areas which are surveyed 30 days ago or less belong in the first group
if (DateDiff(Now(), Date($feature.<field name>), 'days') <= 30) {
     return "Surveyed within the last 30 days" }
//areas which are surveyed more than 30 days but less than 100 days ago belong in the second group
else if (DateDiff(Now(), Date($feature.<field name>), 'days') > 30 &&
DateDiff(Now(), Date($feature.<field name>), 'days') < 100) {
    return "Surveyed between 30 to 100 days ago" }
//areas which are surveyed 100 days ago or more belong in the third group
else if (DateDiff(Now(), Date($feature.<field name>), 'days') >= 100) {
     return "Surveyed more than 100 days ago" }
//areas which do not satisfy any of the given conditions belong in the fourth group
else {
     return "None of these conditions" }
  1. Click OK to close the Expression Builder dialog box. The symbology is updated.
Image of the updated symbology.
Image of the displayed output.

Displaying the date ranges with a date day difference

  1. In ArcGIS Pro, right-click the layer in Contents and click Symbology.
  2. In the Symbology pane, select Unique Value from the Primary symbology drop-down list.
  3. Click the button next to the Field 1 drop-down field to set an expression.
  4. In the Expression Builder dialog box, use the following expression:
Note:
Fill in yyyy,mm,dd and mm/dd/yyyy manually. For the input to the Date() function, use numbers 0-11 for the month values instead of 1-12. 
var revegDate = Date($feature.Created_Date) 
if (revegDate >= Date(yyyy,mm,dd) && revegDate <= Date(yyyy,mm,dd)) { 
return "mm/dd/yyyy- mm/dd/yyyy" } 
else if (revegDate >= Date(yyyy,mm,dd) && revegDate <= Date(yyyy,mm,dd)) { 
return "mm/dd/yyyy- mm/dd/yyyy" } 
else{ return "Some other date range" }
  1. Click OK to close the Expression Builder dialog box. The symbology is updated.
Image of the updated symbology.

Article ID: 000017958

Software:
  • ArcGIS Pro

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