I have a feature class in which I'm trying to calculate the number of days between now, and when a property was last inspected. However, when I try to use the variable for the last inspection date Python/arcgis seems to think LastInsp is a string - but its a date field. I'm baffled, I use a hosted version of this featureclass, and use Arcade to calculate this value using this approach which works fine.
var last_date = $feature.LastInsp;
var now = Today();
var DaysSince = round(DateDiff(now,last_date,'days'))
In field calculator your python expression would be something like:
int(str(datetime.today() - !LastInsp!).split(" ")[0])