PROCÉDURE
In certain cases, when loading new data, the date field is displayed in the format yyyy-mm-dd hh:mm:ss AM/PM. However, there may be instances where displaying the timestamp alongside the date is unnecessary. This article provides instructions to remove the timestamp from the date field 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.
Create a new Date Only field
Note: This workflow is only applicable to ArcGIS Pro 3.2 and later.
FindDate(!FieldName!)
def FindDate(date): if date is None: return None else: return str(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 Temporal Field tool creates a new field in the attribute table.
Note: If Text is selected, select the date format without the timestamp for Output Format.
The following image shows the newly created date field with only the date displayed.
Obtenir de l’aide auprès des experts ArcGIS
Télécharger l’application Esri Support