<?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: AGOL Arcade Question Date Difference in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026953#M38533</link>
    <description>&lt;P&gt;Hi Xander, if you check your PM i sent you a public web map with a snippet of the data im using that replicates the issue&lt;/P&gt;</description>
    <pubDate>Mon, 15 Feb 2021 20:15:43 GMT</pubDate>
    <dc:creator>LukeAllen2</dc:creator>
    <dc:date>2021-02-15T20:15:43Z</dc:date>
    <item>
      <title>AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026369#M38461</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm sort of new to coding in general, but I have started trying to use some arcade expressions in my web maps, currently I have a web map which has a date painted field for hydrants and with the arcade expression below I am using the current date and this field to provide a count of the years and days since a hydrant was last painted.&lt;/P&gt;&lt;P&gt;However, I was QC'ing the data and noticed that for hydrants painted after 2020, it is going to be a day short as 2020 was a leap year - if the web map persists beyond 2024, it will then start being 2 days short.&lt;/P&gt;&lt;P&gt;With my limited knowledge I believe that I need to use some type of when or if statement to be able to use 366 rather than 365 (in var d calculation) i'm just now sure how I would go about doing it - would anybody be able to provide some pointers?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;&lt;P&gt;var timeNow = Now();&lt;BR /&gt;var survey = $feature["DATE_PAINTED"];&lt;/P&gt;&lt;P&gt;var years = DateDiff(timeNow, survey, 'Years');&lt;BR /&gt;// 2.1116274159012844&lt;/P&gt;&lt;P&gt;var y = Floor(years, 0);&lt;BR /&gt;var d = (years - y) * 365;&lt;/P&gt;&lt;P&gt;if (IsEmpty($feature.DATE_PAINTED)){&lt;BR /&gt;return "-"&lt;BR /&gt;} else if (y &amp;gt;= 2) {&lt;BR /&gt;return "Last Painted: " + Round(y, 0) + " years and " + round(d , 0) + " days ago."&lt;BR /&gt;} else if (y == 1) {&lt;BR /&gt;return "Last Painted: " + Round(y, 0) + " year and " + round(d , 0) + " days ago."&lt;BR /&gt;} else if (y == 0) {&lt;BR /&gt;return "Last Painted: " + round(d , 0) + " days ago."&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2021 17:24:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026369#M38461</guid>
      <dc:creator>LukeAllen2</dc:creator>
      <dc:date>2021-02-12T17:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026406#M38462</link>
      <description>&lt;P&gt;that's an interesting one.&amp;nbsp; Can you get the number of years difference, say 2.11 then e.g. create a new variable where you add 2 years to survey, then compare DateDiff(,,'days')&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2021 18:27:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026406#M38462</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-02-12T18:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026455#M38466</link>
      <description>&lt;P&gt;var timeNow = Now();&lt;BR /&gt;var survey = $feature["DATE_PAINTED"];&lt;/P&gt;&lt;P&gt;var years = DateDiff(timeNow, survey, 'Years');&lt;BR /&gt;// 2.1116274159012844&lt;/P&gt;&lt;P&gt;var y = Floor(years, 0);&lt;BR /&gt;var d = (years - y) * 365;&lt;/P&gt;&lt;P&gt;if (IsEmpty($feature.DATE_PAINTED)){&lt;BR /&gt;return "-"&lt;BR /&gt;} else if (y &amp;gt;= 2) {&lt;BR /&gt;return "Last Painted: " + Round(y, 0) + " years and " + Round(d , 0) + " days ago."&lt;BR /&gt;} else if (y == 1) {&lt;BR /&gt;return "Last Painted: " + Round(y, 0) + " year and " + Round(d , 0) + " days ago."&lt;BR /&gt;} else if (y == 0 &amp;amp;&amp;amp; d &amp;gt; 1) {&lt;BR /&gt;return "Last Painted: " + Round(d , 0) + " days ago."&lt;BR /&gt;} else if (y == 0 &amp;amp;&amp;amp; d &amp;lt;= 1) {&lt;BR /&gt;return "Last Painted: " + Round(d , 0) + " day ago."&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Still playing around with it, and getting myself slightly more confused as this point!&lt;/P&gt;&lt;P&gt;When comparing the duration I'm getting from the above code its not quite the same as most online time duration calculators - actually short by 2 days -- is there something obvious that I missing here? (See attachment for context)&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2021 20:04:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026455#M38466</guid>
      <dc:creator>LukeAllen2</dc:creator>
      <dc:date>2021-02-12T20:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026463#M38468</link>
      <description>&lt;P&gt;Try changing the inputs about in the arcade playground&amp;nbsp; &lt;A href="https://developers.arcgis.com/arcade/playground/" target="_blank"&gt;ArcGIS Arcade | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;and see if this suits:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var a = Date('2021-02-12 00:00:01')
var b = Date('2020-01-14 00:00:01')

var years = Floor(DateDiff(a,b,'years'))
var days = DateDiff(a,DateAdd(b, years, 'years'),'days')

return "Last Painted: " + years + " years and " + days + " days ago."&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ArcadeDateDiff.png" style="width: 958px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/5951iE36D322F518BF664/image-size/large?v=v2&amp;amp;px=999" role="button" title="ArcadeDateDiff.png" alt="ArcadeDateDiff.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2021 20:20:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026463#M38468</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-02-12T20:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026466#M38469</link>
      <description>&lt;P&gt;You checked the option "Include end date in calculation", which doesn't not make sense in your case. For example, if you calculate the difference between 1/1/2020 and 1/2/2020 with the option checked, it returns 2 even though it's only one day later.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2021 20:24:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026466#M38469</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-02-12T20:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026539#M38478</link>
      <description>&lt;P&gt;Hi David, thank you I think your code is alot more stream lined and I'll use that with a few adjustments to catch those that were painted today, yesterday or&amp;nbsp; within the same year etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks !&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 00:34:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026539#M38478</guid>
      <dc:creator>LukeAllen2</dc:creator>
      <dc:date>2021-02-13T00:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026546#M38479</link>
      <description>&lt;P&gt;Good stuff, In my head it works conceptually,&amp;nbsp; (let the datetime module do the work - I'm guessing that's what its based on??) A few If Elses for the formatting and should be good.&amp;nbsp; I hope the concept kinda makes sense.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 01:41:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026546#M38479</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-02-13T01:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026608#M38484</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/389554"&gt;@LukeAllen2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I think this thread is related to what you send me by private message. You can use a function that will determine the number of days in a year (taking into account the leap years):&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function daysThisYear() {
    // https://stackoverflow.com/questions/16353211/check-if-year-is-leap-year-in-javascript
    
    // check leap year
    if (((y % 4 == 0) &amp;amp;&amp;amp; (y % 100 != 0)) || (y % 400 == 0)) {
        return 366;
    } else {
        return 365;
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And below the complete expression:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function daysThisYear() {
    // https://stackoverflow.com/questions/16353211/check-if-year-is-leap-year-in-javascript
    
    // check leap year
    if (((y % 4 == 0) &amp;amp;&amp;amp; (y % 100 != 0)) || (y % 400 == 0)) {
        return 366;
    } else {
        return 365;
    }
}

var timeNow = Now();
var survey =  $feature["DATE_PAINTED"];
// var survey = Date(2015, 1, 1);
var years = DateDiff(timeNow, survey, 'Years');
var y = Floor(years, 0);
var d = Round((years - y) * daysThisYear(), 0);

if (IsEmpty($feature.DATE_PAINTED)){
    return "-";
} else if (y &amp;gt;= 2) {
    return "Last Painted: " + y + " years and " + Floor(d , 0) + " days ago.";
} else if (y == 1) {
    return "Last Painted: 1 year and " + Floor(d , 0) + " days ago.";
} else if (y == 0 &amp;amp;&amp;amp; d &amp;gt;= 2) {
    return "Last Painted: " + Floor(d , 0) + " days ago.";
} else if (y == 0 &amp;amp;&amp;amp; d &amp;gt;= 1) {
    return "Last Painted: " + Floor(d , 0) + " day ago.";
} else if (y == 0 &amp;amp;&amp;amp; d &amp;lt; 1) {
    return "Last Painted: today.";
}&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 13 Feb 2021 22:01:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026608#M38484</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-02-13T22:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026944#M38531</link>
      <description>&lt;P&gt;Hi all, Xanders expression seems to work great in the arcade test area of the expression builder, but when I add it to the popup nothing shows, ive no idea what could be causing that to happen?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 19:48:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026944#M38531</guid>
      <dc:creator>LukeAllen2</dc:creator>
      <dc:date>2021-02-15T19:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026949#M38532</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/389554"&gt;@LukeAllen2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Can you validate if the feature has a painted date and can you see in the developer options of the browser if there is any error message when you click on the feature?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 20:03:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026949#M38532</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-02-15T20:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026953#M38533</link>
      <description>&lt;P&gt;Hi Xander, if you check your PM i sent you a public web map with a snippet of the data im using that replicates the issue&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 20:15:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026953#M38533</guid>
      <dc:creator>LukeAllen2</dc:creator>
      <dc:date>2021-02-15T20:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026967#M38534</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/389554"&gt;@LukeAllen2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;My bad. Apparently, there is a line missing in the function. Can you try this?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function daysThisYear() {
    // https://stackoverflow.com/questions/16353211/check-if-year-is-leap-year-in-javascript
    var y = Year(Now());
    
    // check leap year
    if (((y % 4 == 0) &amp;amp;&amp;amp; (y % 100 != 0)) || (y % 400 == 0)) {
        return 366;
    } else {
        return 365;
    }
}

var timeNow = Now();
var survey =  $feature["DATE_PAINT"];
// var survey = Date(2015, 1, 1);
var years = DateDiff(timeNow, survey, 'Years');
var y = Floor(years, 0);
var d = Round((years - y) * daysThisYear(), 0);

if (IsEmpty($feature["DATE_PAINT"])){
    return "-";
} else if (y &amp;gt;= 2) {
    return "Last Painted: " + y + " years and " + Floor(d , 0) + " days ago.";
} else if (y == 1) {
    return "Last Painted: 1 year and " + Floor(d , 0) + " days ago.";
} else if (y == 0 &amp;amp;&amp;amp; d &amp;gt;= 2) {
    return "Last Painted: " + Floor(d , 0) + " days ago.";
} else if (y == 0 &amp;amp;&amp;amp; d &amp;gt;= 1) {
    return "Last Painted: " + Floor(d , 0) + " day ago.";
} else if (y == 0 &amp;amp;&amp;amp; d &amp;lt; 1) {
    return "Last Painted: today.";
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 21:19:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026967#M38534</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-02-15T21:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026968#M38535</link>
      <description>&lt;P&gt;Xander, that worked!&amp;nbsp; Thanks again your patience and help!&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 21:22:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026968#M38535</guid>
      <dc:creator>LukeAllen2</dc:creator>
      <dc:date>2021-02-15T21:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026969#M38536</link>
      <description>&lt;P&gt;You're welcome&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/389554"&gt;@LukeAllen2&lt;/a&gt;&amp;nbsp;. Sorry for the error in the function. It is a bit weird that it was a valid expression in the expression builder. (I also worked with the error in Pro, when it shouldn't have worked...)&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 21:29:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026969#M38536</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-02-15T21:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026972#M38537</link>
      <description>&lt;P&gt;Xander, no apology necessary - thank you for your time and help -- yeah that was what threw me for a loop too&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 21:32:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1026972#M38537</guid>
      <dc:creator>LukeAllen2</dc:creator>
      <dc:date>2021-02-15T21:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1027138#M38544</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/389554"&gt;@LukeAllen2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;To reply to the private message you send, have a look at the code snippet below that will take into account the leap year in a more logical way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// multiple years and days when there is a leapyear
var date1 = Date(2016, 1, 1); // February 1st 2016
var date2 = Date(2020, 2, 1); // March, 1st 2020

// calculate the years as usual
var years = Floor(DateDiff(date2, date1, 'years'));

// create a new date by adding the years to the start date
var date1a = DateAdd(date1, years, 'years');

// calculate the number of days between those date (will account for leap years)
var days = DateDiff(date2, date1a, 'days');

return years + " years and " + days + " days";&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And to put this logic in your example, it will look like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var timeNow = Now();
var survey =  $feature["DATE_PAINT"];
var y = Floor(DateDiff(timeNow, survey, 'Years'));
var date1a = DateAdd(survey, y, 'years');
var d = DateDiff(timeNow, date1a, 'days');

if (IsEmpty($feature["DATE_PAINT"])){
    return "-";
} else if (y &amp;gt;= 2) {
    return "Last Painted: " + y + " years and " + Floor(d , 0) + " days ago.";
} else if (y == 1) {
    return "Last Painted: 1 year and " + Floor(d , 0) + " days ago.";
} else if (y == 0 &amp;amp;&amp;amp; d &amp;gt;= 2) {
    return "Last Painted: " + Floor(d , 0) + " days ago.";
} else if (y == 0 &amp;amp;&amp;amp; d &amp;gt;= 1) {
    return "Last Painted: " + Floor(d , 0) + " day ago.";
} else if (y == 0 &amp;amp;&amp;amp; d &amp;lt; 1) {
    return "Last Painted: today.";
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 13:37:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1027138#M38544</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-02-16T13:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1027144#M38545</link>
      <description>&lt;P&gt;This is the concept I initially posted,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/389554"&gt;@LukeAllen2&lt;/a&gt;&amp;nbsp; did it not work out?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 13:48:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1027144#M38545</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-02-16T13:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1027154#M38547</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167692"&gt;@DavidPike&lt;/a&gt;&amp;nbsp;, sorry about that, you are absolutely right. I will mark it as a solution since it is the way to go.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 14:15:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1027154#M38547</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-02-16T14:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1027540#M38557</link>
      <description>&lt;P&gt;Hi David, yes this worked, sorry i went down a wormhole with some other issue that Xander was helping me work through and forgot to give credits - thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 12:20:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1027540#M38557</guid>
      <dc:creator>LukeAllen2</dc:creator>
      <dc:date>2021-02-17T12:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Arcade Question Date Difference</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1414415#M58797</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/389554"&gt;@LukeAllen2&lt;/a&gt;&lt;/P&gt;&lt;P&gt;- I have this expression that calculates years and populates a field called 'Age'. It gets this information to calculate years from a field called EstbYear (as you can see in the expression below) that I populate with the year it was established. However, it puts the years in the 'Age' field only after the layer is checked and unchecked in the web map. With this happening, another field&amp;nbsp; calculation that relies on 'Age' is not getting calculated unless I go back in and put the age manually first, before I put in the other variables for the calculation to happen&lt;/P&gt;&lt;P&gt;This is the calculation I used which is working just fine:&lt;/P&gt;&lt;P&gt;var currentTime = Year(Now());&lt;BR /&gt;var survey = $feature["EstbYear"];&lt;/P&gt;&lt;P&gt;// Calculate age in years&lt;BR /&gt;var age = 0;&lt;BR /&gt;if (!IsEmpty(survey)) {&lt;BR /&gt;age = currentTime - survey;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;return age;&lt;/P&gt;&lt;P&gt;Is there something I am missing. Do I have to tell somewhere that the next calculation needs to double check the 'Age' field so it can calculate the next field. Do I need to put something in the arcade rule in ArcGIS Pro for the calculation to recognize 'Age' field to so it can see the 'Age' field value to do the next calculation?&lt;/P&gt;&lt;P&gt;Thank you for your help,&lt;BR /&gt;Abi&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 21:01:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/agol-arcade-question-date-difference/m-p/1414415#M58797</guid>
      <dc:creator>AbiDhakal</dc:creator>
      <dc:date>2024-04-23T21:01:41Z</dc:date>
    </item>
  </channel>
</rss>

