ArcGIS Date Query – Using ArcGIS Definition Query for Dates

arcgis-desktoparcmapdatedefinition-query

My attribute table contains a Start date in m/dd/yyyy format. I would like to build a query that only shows data from current month forward.

Does anyone know how to build a query or expression for this problem?

Best Answer

The answer depends on the source of the data. If this is a file geodatabase you could use an expression like:

EXTRACT(MONTH FROM CURRENT_DATE) = EXTRACT(MONTH FROM START) AND EXTRACT(YEAR FROM CURRENT_DATE) = EXTRACT(YEAR FROM START)

The SQL you would need to use would probably be different for a personal geodatabase or Enterprise SDE geodatabase. If your data comes from those databases you should consult the help for Access or your SDE geodatabase server to create a similar query. The query above assumes your start dates are all in the present or the past or you only want dates in the current month and year and not in future months.

Probably a better alternative that works even if the Start field contains dates in future months and you want all dates from the first day of the current month forward the query should be:

START >= CURRENT_DATE - EXTRACT(DAY FROM CURRENT_DATE) + 1