<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Calculating age with two fields in ArcGIS Pro in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/calculating-age-with-two-fields-in-arcgis-pro/m-p/661031#M29287</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kathy,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Insert a new 'Age' field&amp;nbsp; (numerical).&lt;/P&gt;&lt;P&gt;Calculate 'Age' field&amp;nbsp;using&amp;nbsp;Arcade, and insert the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #aa0d91;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;var startDate = Date($feature.startDateField);&lt;/P&gt;&lt;P&gt;var endDate = Date($feature.endDateField);&lt;/P&gt;&lt;P&gt;var age = DateDiff(endDate, startDate, 'years');&lt;/P&gt;&lt;P&gt;return age;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for details see the DateDiff function in:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/arcade/function-reference/date_functions/#datediff" title="https://developers.arcgis.com/arcade/function-reference/date_functions/#datediff"&gt;Date Functions | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Uri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Feb 2020 23:52:34 GMT</pubDate>
    <dc:creator>UriGilad_EsriAu</dc:creator>
    <dc:date>2020-02-10T23:52:34Z</dc:date>
    <item>
      <title>Calculating age with two fields in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculating-age-with-two-fields-in-arcgis-pro/m-p/661029#M29285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How would you calculate age in ArcGIS Pro based on BornDate and DeathDate fields?&amp;nbsp; I am working on creating a feature class to map cemetery graves using the Collector app.&amp;nbsp; The two fields are both a date type.&amp;nbsp; 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.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2020 20:43:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculating-age-with-two-fields-in-arcgis-pro/m-p/661029#M29285</guid>
      <dc:creator>KathyAdelman</dc:creator>
      <dc:date>2020-02-10T20:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating age with two fields in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculating-age-with-two-fields-in-arcgis-pro/m-p/661030#M29286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kathy. Date fields are python datetime objects which can be handy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field 1 - Field 2&amp;nbsp; &amp;nbsp; &amp;nbsp;produces a TimeDelta object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TimeDelta.total_seconds()&amp;nbsp; will produce the number of seconds of the timedelta object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe the timedelta will take into account leap years so the result may be off several days from what you may expect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Total_seconds = (TimeField1 - TimeField2).total_seconds()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SecInYear = (60*60*24*365.25)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Years = Total_seconds/SecInYear&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is very basic and prone to error. Hopefully someone can give a better answer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2020 22:24:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculating-age-with-two-fields-in-arcgis-pro/m-p/661030#M29286</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-02-10T22:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating age with two fields in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculating-age-with-two-fields-in-arcgis-pro/m-p/661031#M29287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kathy,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Insert a new 'Age' field&amp;nbsp; (numerical).&lt;/P&gt;&lt;P&gt;Calculate 'Age' field&amp;nbsp;using&amp;nbsp;Arcade, and insert the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #aa0d91;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;var startDate = Date($feature.startDateField);&lt;/P&gt;&lt;P&gt;var endDate = Date($feature.endDateField);&lt;/P&gt;&lt;P&gt;var age = DateDiff(endDate, startDate, 'years');&lt;/P&gt;&lt;P&gt;return age;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for details see the DateDiff function in:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/arcade/function-reference/date_functions/#datediff" title="https://developers.arcgis.com/arcade/function-reference/date_functions/#datediff"&gt;Date Functions | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Uri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2020 23:52:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculating-age-with-two-fields-in-arcgis-pro/m-p/661031#M29287</guid>
      <dc:creator>UriGilad_EsriAu</dc:creator>
      <dc:date>2020-02-10T23:52:34Z</dc:date>
    </item>
  </channel>
</rss>

