Frequently asked question

What is the proper SQL syntax for date field queries in ArcGIS?

Last Published: April 26, 2020

Answer

The SQL syntax for querying date fields varies according to DBMS. Unfortunately it can vary widely, even though SQL is the standard and most popular DBMSs use for queries. The following examples should be helpful:

Personal Geodatabases:
[DATE_FIELD] = #1970/8/17# 
[DATE_FIELD] = DateSerial(1970,8,17) 

Coverages, shapefiles and SDE geodatabases comply with SQL standards:
"DATE_FIELD" = date '1970/8/17'

Data formats and SQL syntax for some DBMSs or versions of DBMSs may be different than what is shown above. For more information, check the Select by Attributes dialog box by clicking either Help or the SQL Info button.

Article ID:000012736

Software:
  • Legacy Products
  • ArcMap 9 x
  • ArcMap 8 x

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic