I have a Date field in an ArcGIS file geodatabase feature class called "DateTemp1." I created a new text field called "DateTemp2" and want to calculate that based on the DateTemp1 field, but I am getting a unicode error.
TypeError: descriptor 'strftime' requires a 'datetime.date' object but received a 'unicode'
arcpy.CalculateField_management("all_reports.gdb/lsr_reports1", "DateTemp2", "datetime.datetime.strftime(!DateTemp1!, '%Y%m%d')", "PYTHON_9.3", "")
CalculateField
passes the date field as a string into Python. In other words, you could have simply used the expression!DateTemp1!
and you would have gotten a string formatted using the default expression (usually MM/DD/YYYY).