HOW TO
Instructions provided describe some examples for writing SQL statements to select only portions of a date-time field, which can then be used in WHERE clauses throughout ArcGIS.
Note: Please note that the method for parsing these parts of the data varies based on database used to store the data.
File Geodatabase, shapefiles, and file-based data such as dbf files
The standard view would look like this:
EXTRACT(extract_part FROM extract_source) = VALUE
EXTRACT(MONTH FROM "MyDate") = 03
EXTRACT(HOUR FROM "MyDate") < 12
Note: Time parts cannot be called from a shapefile or file-based data because they only support the use of DATE and not TIME.
Personal Geodatabase
These use Microsoft's DatePart function to extract a portion of the date.
DATEPART(PART, DATEFIELD) = VALUE
DATEPART("m", [MyDate]) = 03
DATEPART("h", [MyDate]) < 12
Other databases
Please consult the database's function documentation and syntax.
For example, SQL server uses the same DATEPART function as personal geodatabases, but with slightly different syntax:
DATEPART(year, MyDate) = 2012
Get help from ArcGIS experts
Download the Esri Support App