Select to view content in your preferred language

show/hide data in ArcGIS layer based on date or time

319
2
Jump to solution
05-12-2025 07:06 AM
Labels (2)
CarlosRishmawi1
New Contributor

Hello community, 

 

I added a line featurelayer in Arcgis online with   "timeFrom" and "timeTo" fields, and I want to hide the data from the map depending on that time period.


for example:   timeFrom: "10:30",  timeTo: "22:00",

I want to show all data on the map between the two times and hide the data outside that period for each row of data

Can this be done using Arcade, or is there another experience?

0 Kudos
1 Solution

Accepted Solutions
CodyPatterson
MVP Regular Contributor

Hey @CarlosRishmawi1 

I've done something similar, since you have the time in 24 hour format, you could drop the colon, and reduce it to 1030 and 2200, then use "Is between" in the filter menu, that would bring things in that range:

The only INT field I had was OBJECTID but you'd use yours:

CodyPatterson_0-1747082144478.png

If this doesn't work for you, just let me know and I'll get you an Arcade script if needed!

Cody

View solution in original post

2 Replies
CodyPatterson
MVP Regular Contributor

Hey @CarlosRishmawi1 

I've done something similar, since you have the time in 24 hour format, you could drop the colon, and reduce it to 1030 and 2200, then use "Is between" in the filter menu, that would bring things in that range:

The only INT field I had was OBJECTID but you'd use yours:

CodyPatterson_0-1747082144478.png

If this doesn't work for you, just let me know and I'll get you an Arcade script if needed!

Cody

CarlosRishmawi1
New Contributor

@CodyPatterson, thanks for your answer, but the idea is to make this run programaticaly or dynamically.

i want to show the data only with the system time is between the two date fields, knowing that the fields are "FromTime" and "ToTime", SQL where  will be something like this:

"FromTime >= CURRENT_TIMESTAMP() AND CURRENT_TIMESTAMP() < ToTime"
 
so it will be great to do this with arcade 🙂

 

thanks in advance
Carlos

0 Kudos