I am trying to use an expression to convert my date field to a simple %d,%b,%Y format. Right now it is in "%Y%m%d %H:%M:%S %z"
How do I do it properly using Python to do this in ArcGIS Pro?
Q&As from ArcMap have given me errors.
My labels are coming from my [Date] field.
Here's one example of a code I tried -
def FindLabel ( [Date] ):
return str(datetime.datetime.strptime([Date],"%Y/%m/%d %H:%M:%S %z").date())
and I got this error:
My labels look this :
I also tried this code:
from datetime import datetime
def FindLabel ( [Date] ):
d = datetime.strptime([Date], '%Y/%m/%d %H:%M:%S %z')
return d.strftime('%d, %b %Y')