<?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 Help with dates in arcade?  in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/help-with-dates-in-arcade/m-p/72597#M3442</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friends,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a little python script that calculates&amp;nbsp; whether this week is an even week or an odd week.&amp;nbsp;&lt;BR /&gt;I need this in arcade to populate in an AGOL app but I am below beginner level with arcade and finding it difficult to find samples to work with.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anybody have the ability to help me put together a small arcade&amp;nbsp; expression that does what my python does or else point me to where I can find some samples?&amp;nbsp; There is a world of python samples out there, but arcade is harder to find.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;from datetime import *&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#make sure to always start on a monday&lt;BR /&gt;startDate = date(2019, 12, 2)&amp;nbsp;&lt;/P&gt;&lt;P&gt;todayDate = date.today()&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# count the days between the dates&lt;BR /&gt;delta = todayDate - startDate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#count the number of weeks since start date&lt;BR /&gt;weekNum = delta.days / 7&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#determine if this week is even or odd&lt;BR /&gt;# Python program to check if the input number is odd or even.&lt;BR /&gt;# A number is even if division by 2 gives a remainder of 0.&lt;BR /&gt;# If the remainder is 1, it is an odd number.&lt;BR /&gt;num = int(weekNum)&lt;BR /&gt;if (num % 2) == 0:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;BR /&gt;print("{0} is Even".format(num))&lt;BR /&gt; print "This week is paper recycling"&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;else:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;BR /&gt; print("{0} is Odd".format(num))&lt;BR /&gt; print "This week is container recycling"&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Dec 2019 17:39:15 GMT</pubDate>
    <dc:creator>JamesHood</dc:creator>
    <dc:date>2019-12-17T17:39:15Z</dc:date>
    <item>
      <title>Help with dates in arcade?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-with-dates-in-arcade/m-p/72597#M3442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friends,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a little python script that calculates&amp;nbsp; whether this week is an even week or an odd week.&amp;nbsp;&lt;BR /&gt;I need this in arcade to populate in an AGOL app but I am below beginner level with arcade and finding it difficult to find samples to work with.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anybody have the ability to help me put together a small arcade&amp;nbsp; expression that does what my python does or else point me to where I can find some samples?&amp;nbsp; There is a world of python samples out there, but arcade is harder to find.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;from datetime import *&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#make sure to always start on a monday&lt;BR /&gt;startDate = date(2019, 12, 2)&amp;nbsp;&lt;/P&gt;&lt;P&gt;todayDate = date.today()&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# count the days between the dates&lt;BR /&gt;delta = todayDate - startDate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#count the number of weeks since start date&lt;BR /&gt;weekNum = delta.days / 7&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#determine if this week is even or odd&lt;BR /&gt;# Python program to check if the input number is odd or even.&lt;BR /&gt;# A number is even if division by 2 gives a remainder of 0.&lt;BR /&gt;# If the remainder is 1, it is an odd number.&lt;BR /&gt;num = int(weekNum)&lt;BR /&gt;if (num % 2) == 0:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;BR /&gt;print("{0} is Even".format(num))&lt;BR /&gt; print "This week is paper recycling"&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;else:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;BR /&gt; print("{0} is Odd".format(num))&lt;BR /&gt; print "This week is container recycling"&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Dec 2019 17:39:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-with-dates-in-arcade/m-p/72597#M3442</guid>
      <dc:creator>JamesHood</dc:creator>
      <dc:date>2019-12-17T17:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: Help with dates in arcade?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-with-dates-in-arcade/m-p/72598#M3443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Give this a try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;var startDate = Date(2019, 11, 2); //Months are 0-11
var todayDate = Now();

var delta = Abs(DateDiff(startDate, todayDate, "days"));
var weekNum = Floor(delta/7);
if ((weekNum % 2) == 0){
    return "even" + ", " + delta + ", " + weekNum;
} else {
    return "odd"+ ", " + delta + ", " + weekNum;
}&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:49:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-with-dates-in-arcade/m-p/72598#M3443</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-10T22:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: Help with dates in arcade?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-with-dates-in-arcade/m-p/72599#M3444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ken Buja, you are the best, most capable Bro on GeoNet today.&lt;/P&gt;&lt;P&gt;I was all Ric Flair over here when I saw your response.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="" href="https://youtu.be/2sSofokAIiw" title="https://youtu.be/2sSofokAIiw"&gt;Ric Flair Woo - YouTube&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3 gold stars!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Dec 2019 22:23:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-with-dates-in-arcade/m-p/72599#M3444</guid>
      <dc:creator>JamesHood</dc:creator>
      <dc:date>2019-12-17T22:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: Help with dates in arcade?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-with-dates-in-arcade/m-p/72600#M3445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;Ken Buja, you are the best, most capable Bro on GeoNet today.&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;I was all Ric Flair over here when I saw your response.&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;A class="" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fyoutu.be%2F2sSofokAIiw" rel="nofollow" style="color: #287433; border: 0px; font-weight: inherit; text-decoration: none; font-size: 14px; padding: 0px calc(12px + 0.35ex) 0px 0px;" target="_blank"&gt;Ric Flair Woo - YouTube&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;3 gold stars!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Dec 2019 22:23:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-with-dates-in-arcade/m-p/72600#M3445</guid>
      <dc:creator>JamesHood</dc:creator>
      <dc:date>2019-12-17T22:23:43Z</dc:date>
    </item>
  </channel>
</rss>

