FAQ: What is the proper SQL syntax for date field queries in ArcGIS?
What is the proper SQL syntax for date field queries in ArcGIS?
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:
[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.