English
Continue in the app
Be The First To Get Support Updates
Want to know about the latest technical content and software updates?

How To: Symbolize a range of dates using Arcade in ArcGIS Pro

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.

Related Information

Last Published: 9/2/2021

Article ID: 000017958

Software: ArcGIS Pro 2.8.2, 2.8.1, 2.8, 2.7.4, 2.7.3, 2.7.2, 2.7.1, 2.7, 2.6.6, 2.6.5, 2.6.4, 2.6.3, 2.6.2, 2.6.1, 2.6, 2.5.2, 2.5.1, 2.5, 2.4.3, 2.4.2, 2.4.1, 2.4, 2.3.3, 2.3.2, 2.3.1, 2.3, 2.2.4, 2.2.3, 2.2.2, 2.2.1, 2.2, 2.1.3, 2.1.2, 2.1.1, 2.1, 2.0.1, 2.0, 1.4.1, 1.4, 1.3.1, 1.3, 1.2