HOW TO
A shapefile stores dates in a date field with the yyyy-mm-dd format. A geodatabase formats the date as datetime yyyy-mm-dd hh:mm:ss AM or PM. ArcGIS Pro follows the Windows settings for date formats, and displays both the date and timestamps in the date fields. In some instances, the timestamp is not required to be displayed together with the date. This article provides instructions to remove the timestamp from the date fields in the attribute table in ArcGIS Pro.
Use one of the methods below to remove the timestamp from the date fields in the attribute table in ArcGIS Pro.
FindDate(!FieldName!)
def FindDate(date): if date is None: return None else: return date.split(" ").pop(0)
Note: Alternatively, in the expression box, copy and paste the following script and replace FieldName accordingly. timestamp(!FieldName!) In the Code Block box, copy and paste the following script: from datetime import datetime def timestamp(mydate): date = mydate strdate = date.strftime("%Y/%m/%d") finaldate = datetime.strptime(strdate,"%Y/%m/%d") return finaldate
The following image shows the date field with only the date displayed in the attribute table.
Note: Using the Convert Time Field tool creates a new field in the attribute table.
The following image shows the newly created date field with only the date displayed.
Get help from ArcGIS experts
Download the Esri Support App