<?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 Automate Field Value Changes on Date in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/automate-field-value-changes-on-date/m-p/50988#M4045</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I an woefully inadequate when it comes to developing Python code.&amp;nbsp; I am nearing completion of the AGOL Polling Place Finder application for 10.2 with some relatively basic customizations.&amp;nbsp; I do however want to include a status (open / closed) field for each individual polling location and, ideally, I would like to have that status automatically change to the applicable value on an election day.&amp;nbsp; It would be even better if those values changed during set hours (polls are open from 6am -8pm).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have fields for next election date, as well as poll opening and closing times.&amp;nbsp; I just lack the Python skills to put together the necessary function to automate the process.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help would be most appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jason&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 10 May 2014 16:09:43 GMT</pubDate>
    <dc:creator>deleted-user-o0qo22IL6bb6</dc:creator>
    <dc:date>2014-05-10T16:09:43Z</dc:date>
    <item>
      <title>Automate Field Value Changes on Date</title>
      <link>https://community.esri.com/t5/python-questions/automate-field-value-changes-on-date/m-p/50988#M4045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I an woefully inadequate when it comes to developing Python code.&amp;nbsp; I am nearing completion of the AGOL Polling Place Finder application for 10.2 with some relatively basic customizations.&amp;nbsp; I do however want to include a status (open / closed) field for each individual polling location and, ideally, I would like to have that status automatically change to the applicable value on an election day.&amp;nbsp; It would be even better if those values changed during set hours (polls are open from 6am -8pm).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have fields for next election date, as well as poll opening and closing times.&amp;nbsp; I just lack the Python skills to put together the necessary function to automate the process.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help would be most appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jason&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 May 2014 16:09:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-field-value-changes-on-date/m-p/50988#M4045</guid>
      <dc:creator>deleted-user-o0qo22IL6bb6</dc:creator>
      <dc:date>2014-05-10T16:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Automate Field Value Changes on Date</title>
      <link>https://community.esri.com/t5/python-questions/automate-field-value-changes-on-date/m-p/50989#M4046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In order to test for the date and time, you can use the &lt;/SPAN&gt;&lt;A href="https://docs.python.org/2/library/datetime.html#datetime.date.strftime" rel="nofollow noopener noreferrer" target="_blank"&gt;datetime&lt;/A&gt;&lt;SPAN&gt; module. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A couple code examples:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import datetime

date = datetime.datetime.now()

# Access your date attributes
print date.day
print date.month
print date.year

&amp;gt;&amp;gt;&amp;gt; # Print a formatted date string
&amp;gt;&amp;gt;&amp;gt; print date.strftime("%m/%d")
&amp;gt;&amp;gt;&amp;gt; '05/10'

# Test if between 6am and 8pm
if 6 &amp;lt; date.hour &amp;lt; 20:
 print "It is election time"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could use some of the above methods to test for date and hour and change your field attributes accordingly through tools such as &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000004m000000" rel="nofollow noopener noreferrer" target="_blank"&gt;Calculate Field&lt;/A&gt;&lt;SPAN&gt; or an &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//018w00000014000000" rel="nofollow noopener noreferrer" target="_blank"&gt;Update Cursor&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:58:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-field-value-changes-on-date/m-p/50989#M4046</guid>
      <dc:creator>MattEiben</dc:creator>
      <dc:date>2021-12-10T21:58:21Z</dc:date>
    </item>
  </channel>
</rss>

