How to create in ArcMap a Definition Query/Query Builder to retrieves records from Todays date

288
2
07-22-2021 05:27 AM
Labels (1)
JoseSanchez
Occasional Contributor III

ood morning 

The feature class has a StartDate and a EndDate

I am looking for a way to create in ArcMap the following  Definition Query/Query Builder:

   -  select records from todays date to the future. or selecting records with a EndDate > Today

    - select records from todays date minus 3 years or selecting records with StartDate less than 3 years

This mxd is going to be used in  a map service, so the goal is to return these values when  showing the layers in a GIs viewers.

 

Thanks

0 Kudos
2 Replies
Smith_Mike
New Contributor

Jose,

Your End Date attribute will have a syntax of how your date is stated. You can simply change the date in the query builder to match what you need. This is something that works in our feature class. I selected any value in the query builder and modified it to fit a date 3 years earlier. You could do the same for one to match today and go forward. If you have end dates the need to be between dates then use the AND operator to set between two dates like below.

LASTUPDATEDATE >= timestamp '2018-06-20 15:59:28'

LASTUPDATEDATE >= timestamp '2018-06-20 15:59:28' AND LASTUPDATEDATE <= timestamp '2021-06-15 14:25:50'

0 Kudos
JayantaPoddar
MVP Esteemed Contributor

What is the data-source (Shapefile, File GDB, Personal GDB, Enterprise GDB like Oracle, SQL Server or PostgreSQL)? 



Think Location
0 Kudos