I am new to building expressions in Arcade and I am having trouble writing an expression that can be used to check start and end times of different areas and evaluate if the current date is within the start and end time for each area. Ideally the expression would check the current time and symbolize each area based on if it is within the start and end times or not.

My layer has both a start time and end time feature in Date format. I would like to symbolize each area as either 'opened' or 'closed' based on pre set start and end times.

Here is what I have come up with so far that doesn't quite work as I'd like:

//Expression that evaluates the status of crab catch areas

//returns open if current time is within start and end times

//returns closed if current time is outside of start and end times

var started = $feature.StartTime;

var present = Now()

IIf(started < present, 'open', 'closed')

var closed = $feature.EndTime;

IIf(closed > present, 'open', 'closed')

Right now it will not correctly symbolize the layer based on given start and end times.

Does anyone know where I messed up or another way to go about making a custom expression for this task?

This is for a map created and managed on ArcGIS Online.

  • Are you testing this in ArcGIS Pro, or somewhere else?
    – PolyGeo
    Oct 31, 2018 at 23:24
  • This is for a map created and managed on ArcGIS Online Oct 31, 2018 at 23:40
  • Thank you very much Russ! Your expression works beautifully and does exactly what I wanted. Thanks! Nov 1, 2018 at 18:49

1 Answer 1


Try this

 var started = $feature.StartTime
    var closed = $feature.EndTime
var present = Now()

// if current date/time is greater than or equal to the start time
// AND current date/time is less than or equal to the close time 
// return open, otherwise its closed
If (present >= started && present <= closed) {
    return "Open"
} else {
    return "Closed"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.