How would you calculate age in ArcGIS Pro based on BornDate and DeathDate fields? I am working on creating a feature class to map cemetery graves using the Collector app. The two fields are both a date type. I am trying to do this in ArcGIS Pro, which I am new at, and it looks like the formula to deduct the BornDate from DeathDate and divide by 365 is not working.
Hi Kathy. Date fields are python datetime objects which can be handy.
Field 1 - Field 2 produces a TimeDelta object.
TimeDelta.total_seconds() will produce the number of seconds of the timedelta object.
I believe the timedelta will take into account leap years so the result may be off several days from what you may expect.
Total_seconds = (TimeField1 - TimeField2).total_seconds()
SecInYear = (60*60*24*365.25)
Years = Total_seconds/SecInYear
This is very basic and prone to error. Hopefully someone can give a better answer
Insert a new 'Age' field (numerical).
Calculate 'Age' field using Arcade, and insert the following:
var startDate = Date($feature.startDateField);
var endDate = Date($feature.endDateField);
var age = DateDiff(endDate, startDate, 'years');
for details see the DateDiff function in:
Hope this helps,