HOW TO
In an attribute table containing a date field for a feature layer in Portal for ArcGIS and ArcGIS Online, removing expired dates from today's date is important for data accuracy as inconsistencies can lead to errors.
This article describes the workflow to remove dates before the current date in an attribute table using an Arcade expression in Portal for ArcGIS and ArcGIS Online.
In this example, the attribute table contains invalid dates considering today's date is January 26, 2024.
var today = Now();
var expirationDate = $feature['Expired'];
if (expirationDate < today) { return null; } else { return expirationDate; }
The code block below shows the full working script.
var today = Now(); var expirationDate = $feature['Your_Date_Field']; if (expirationDate < today) { return null; } else { return expirationDate; }
The image below shows the attribute table after removing the invalid dates.
Get help from ArcGIS experts
Download the Esri Support App