Select to view content in your preferred language

Arcade expression for date equals today or earlier

4557
2
Jump to solution
07-27-2020 11:37 AM
LeifJohnson3
Frequent Contributor

How can I write an arcade expression that would change the symbology of a webmap based on whether or not a date is equal to or before today's date?

0 Kudos
1 Solution

Accepted Solutions
DonShawEsri
Esri Contributor

Hi, you can do something like this:

var event_time = $feature.eventTime;

var today_date = Today();
var diff = DateDiff(today_date, event_time, 'days');


if(diff > 0){
return 'before today';
}

else(diff <0)
return 'today';

View solution in original post

2 Replies
DonShawEsri
Esri Contributor

Hi, you can do something like this:

var event_time = $feature.eventTime;

var today_date = Today();
var diff = DateDiff(today_date, event_time, 'days');


if(diff > 0){
return 'before today';
}

else(diff <0)
return 'today';

LeifJohnson3
Frequent Contributor

Thank you so much Donald Shaw. This is extremely helpful!