Date Query within a File GDB for the last month

06-18-2015 05:23 AM
New Contributor III

I am trying to set up a expression within a File GDB that selects all the new features created in the last month. I want to find all the new services/valves that where created in the last month. I have successfully found how to query the last month in a SDE environment but not within a File GDB. The syntax is different for a File GDB and I can't seem to find documentation to help.

I want to automate this selection through modelbuilder then export to a script and then run on windows scheduler. Thanks for your help.

So the logic is something like this (Which works in a SDE environment but not on a file GDB)

year( created_date)=year(CURRENT_TIMESTAMP) and month(created_date)=month(CURRENT_TIMESTAMP)-1

0 Kudos
1 Reply
Esri Esteemed Contributor

Most SQL code related to dates will not work across databases, so even if that query worked with one enterprise geodatabase, it's unlikely to work with any others.  Since file geodatabase doesn't even have a database to lean on for date functions, there isn't much to work with here at all.

You haven't specified the language you are using, so it's difficult to give specific direction, but what you'll need to do is use your query interface to structure a start time and a stop time, then query:

     created_date >= START_TIME and created_date < STOP_TIME

- V

0 Kudos