Hi all, I'm seeing if it's possible to manipulate a date function so i could use date fields as a range to update the feature each month automatically, and won't have to change the year every time. Here is the code I have so far.
Solved! Go to Solution.
When building the date, just insert a variable for the year
var time = Now();
var time3 = Text(Now(), "MMMM DD, YYYY");
var thisYear = Year(Now());
if (time >= Date(thisYear, 7, 1) && time < Date(thisYear, 8, 1)) {
return $feature["August"];
}
Arcade has a Month() function. It returns 1 (Jan) - 12 (Dec).
Date functions | ArcGIS Arcade | Esri Developer
this article should have all the code you need, incl. a dictionary to map the number to the month name.
How To: Extract Month Names from a Date Field Using ArcGIS Arcade in Map Viewer
Thanks for the help, but I should have been clearer - I'm looking for a Date function that only takes the month and day, but without the year.
When building the date, just insert a variable for the year
var time = Now();
var time3 = Text(Now(), "MMMM DD, YYYY");
var thisYear = Year(Now());
if (time >= Date(thisYear, 7, 1) && time < Date(thisYear, 8, 1)) {
return $feature["August"];
}
thank you Ken! That worked!