<?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 Update a field based on date in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/update-a-field-based-on-date/m-p/425329#M33406</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How can I update a field based on if the date in another field has passed or not?&amp;nbsp; In other words, which arcpy function or method can be used that will change an attribute from "current" to "expired" when the date in the date field associated with that feature has passed?&amp;nbsp; The goal is to have a tool/button that updates the features based on date and then exports to pdf.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Jun 2013 18:46:10 GMT</pubDate>
    <dc:creator>DamonOsbourne</dc:creator>
    <dc:date>2013-06-07T18:46:10Z</dc:date>
    <item>
      <title>Update a field based on date</title>
      <link>https://community.esri.com/t5/python-questions/update-a-field-based-on-date/m-p/425329#M33406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How can I update a field based on if the date in another field has passed or not?&amp;nbsp; In other words, which arcpy function or method can be used that will change an attribute from "current" to "expired" when the date in the date field associated with that feature has passed?&amp;nbsp; The goal is to have a tool/button that updates the features based on date and then exports to pdf.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jun 2013 18:46:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-a-field-based-on-date/m-p/425329#M33406</guid>
      <dc:creator>DamonOsbourne</dc:creator>
      <dc:date>2013-06-07T18:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Update a field based on date</title>
      <link>https://community.esri.com/t5/python-questions/update-a-field-based-on-date/m-p/425330#M33407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There are a few different ways to get the current date and time from the system using Python.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for example...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; import datetime&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; datetime.datetime.now()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;datetime.datetime(2013, 6, 10, 7, 59, 43, 458000)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This returns a datetime object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Your date field value can be retrived and compared to the now object.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The later date / time value will be greater&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If your date fields are strings, you can turn them into datetaime objects using&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;datetime.strptime(date_string, format)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The python standard library has a list of the format tags.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jun 2013 11:05:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-a-field-based-on-date/m-p/425330#M33407</guid>
      <dc:creator>markdenil</dc:creator>
      <dc:date>2013-06-10T11:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: Update a field based on date</title>
      <link>https://community.esri.com/t5/python-questions/update-a-field-based-on-date/m-p/425331#M33408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you are trying to update the field on the currently selected feature(s), then CalculateField_management would do it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If itering through all the features in your FC, might iterate through with UpdateCursor, if date &amp;amp;LT current date, then update field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jun 2013 15:21:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-a-field-based-on-date/m-p/425331#M33408</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2013-06-10T15:21:12Z</dc:date>
    </item>
  </channel>
</rss>

