I have a script that automatically updates a sync enabled sde feature class. I populate the last_edited_date field with datetime.now(). This has worked for over a year until last week. All of a sudden I'm getting this error RuntimeError: The value type is incompatible with the field type. [last_edited_date]. Not sure what's going on. The date field in the feature class is in this format: %m/%d/%Y %H:%M%p or 1/28/2021 1:05 PM.
Datetime.now() prints this format: 2021-01-28 13:06:30.180737
Solved! Go to Solution.
Finally figured this out. I'm updating two nearly identical datasets, one for the web and one in local projection for printed maps. The local dataset lacks a Global ID field, so the indexs were off by one and the script was trying to put a date in a non-date field. It's strange that this hasn't been an issue before.
did you perhaps switch from python 2.7 to 3.x (aka arcmap to arcgis pro, or within SDE)
As for the international formatting issue, you now have nanosecond precision.
datetime — Basic date and time types — Python 3.9.1 documentation just select the 3.7 docs when you are there for changes if this is your case