Whether you're displaying, calculating, or selecting date attributes, you must determine the appropriate way to work with date fields in your database.
Selecting and displaying date field values using the Select Layer By Attribute tool and similar query-building dialog boxes is done using an SQL syntax. The SQL syntax used to select and display date field values varies based on the type of database. This is described in detail in the SQL reference topic.
Calculating and displaying date fields in the attribute table is done in a different format and syntax. This is because the field calculator in ArcGIS Pro uses Python functions and the display format depends on your regional settings, rather than the underlying database's format on the system.
Displaying dates
A shapefile stores dates in a date field with this format: yyyy-mm-dd. A geodatabase formats the date as datetime yyyy-mm-dd hh:mm:ss AM or PM. Settings on your Windows system determine how the dates display in ArcGIS Pro—M/d/yy, MM/dd/yy, yy/MM/dd, and so on. ArcGIS Pro uses the system short date format (numerical) to display dates. While these are the default format, dates can also be formatted to display differently in both the table and a pop-up.
ArcGIS Pro follows the Windows settings for date formats.
Note:
Time zone information for a Date field in a web feature layer is displayed in the ToolTip for the field header as well as any calendar control when editing those values. By default, the value is set to Universal Time Coordinated (UTC), unless a preferred time zone has been set.
Learn more about editing map and feature service settings, including time zone
A web feature layer refers to a feature layer from a map or feature service.
Calculating date fields
When calculating date fields, the field calculator uses Python datetime functions. Some of the functions support datetime yyyy-mm-dd hh:mm:ss AM or PM. However, for shapefiles, the time portion is truncated from the datetime value. For example, the datetime 2002-08-20 12:00:00 PM is stored in a shapefile as 2002-08-20.
You can use any Python datetime function to calculate a date. If you want to calculate an attribute equal to the current time, use the today() function.
You can also use two digits for the year value when calculating dates. When you calculate a date such as date_field = dateserial(02,8,20) and specify two digits for the year (02 in this case), your system's settings control which century is used. You can adjust these settings through the region and time options in Windows.
Select features using a date field
You can build an SQL selection query for date fields, numeric fields, and string fields using the Select Layer By Attribute geoprocessing tool. You can select individual or multiple records by querying a dataset based on a date value. A data-dependent syntax is required for querying dates.
Refer to the SQL reference guide for a description of the different syntax and the specifications of querying dates.