Skip to main content
Solved

Filter last year's worth of data

  • March 27, 2026
  • 3 replies
  • 46 views

brittzucchetto
Contributor
Forum|alt.badge.img+4

I have an AGOL feature layer with a DateOnly field that I am trying to filter out the last 365 days worth of data. Is there an easy way to complete this?

The data is formatted in the following way:

2021-01-01

Best answer by crutledge

Hi ​@brittzucchetto 
You could use a tester or filter and use the DateTimeDiff() function to calculate the time interval in days and then filter greater than / less than 365.
Hope that helps!
 

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

crutledge
Influencer
Forum|alt.badge.img+46
  • Influencer
  • Best Answer
  • March 27, 2026

Hi ​@brittzucchetto 
You could use a tester or filter and use the DateTimeDiff() function to calculate the time interval in days and then filter greater than / less than 365.
Hope that helps!
 

 


hkingsbury
Celebrity
Forum|alt.badge.img+70
  • Celebrity
  • March 29, 2026

An approach I really like when dealing with more complex date/time filtering (​@crutledges approach outline above is perfect for your use case) is to turn the dates into points.

Firstly, convert the dates into epochs (seconds since 1/1/1970) then using a VertexReplacer, use the epoch as the X value (set the Y to zero). 

This now give you each feature as point along a date/time continuim.

If you have a data range you want to filter, use a similar approach, but create a line instead. You can then use spatial tools to find point on the line, spatial group the point etc.

 

As someone who often struggles with date/times (especially with timezones) this apporach has been really helpful (original credit, many years ago, to ​@todd_davis )


brittzucchetto
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • March 30, 2026

Hi ​@brittzucchetto 
You could use a tester or filter and use the DateTimeDiff() function to calculate the time interval in days and then filter greater than / less than 365.
Hope that helps!
 

 

Hi ​@crutledge,

 

I ended up using this exact approach to solve the issue! I’m glad I was on the right track. Thanks for the quick reply!