HOW TO
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.
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.
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
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" }
Displaying the date ranges with a date day difference
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" }
Get help from ArcGIS experts
Download the Esri Support App