<?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 calculate date-field with python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/calculate-date-field-with-python/m-p/510383#M40109</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi. I have a string-field (called 'unsplit') which contains concatenated values from other fields separated by a comma (example: 24.07.2010,street,...). I want to split/extract each commaseparated value and calculate it to a new field. I am using the field calculator and a pythonexpression. This expression works fine to calculate the value 'street' to a string-field: '!unsplit!.split(',')[1]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;However, i can't calculate the value 24.07.2010 to a date-field using this expression: '!unsplit!.split(',')[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The error message is: &amp;lt;type 'exceptions.SyntaxError'&amp;gt;:EOL while scanning string literal.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What is wrong?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Sep 2012 19:26:57 GMT</pubDate>
    <dc:creator>MartinEgger</dc:creator>
    <dc:date>2012-09-26T19:26:57Z</dc:date>
    <item>
      <title>calculate date-field with python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-date-field-with-python/m-p/510383#M40109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi. I have a string-field (called 'unsplit') which contains concatenated values from other fields separated by a comma (example: 24.07.2010,street,...). I want to split/extract each commaseparated value and calculate it to a new field. I am using the field calculator and a pythonexpression. This expression works fine to calculate the value 'street' to a string-field: '!unsplit!.split(',')[1]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;However, i can't calculate the value 24.07.2010 to a date-field using this expression: '!unsplit!.split(',')[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The error message is: &amp;lt;type 'exceptions.SyntaxError'&amp;gt;:EOL while scanning string literal.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What is wrong?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2012 19:26:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-date-field-with-python/m-p/510383#M40109</guid>
      <dc:creator>MartinEgger</dc:creator>
      <dc:date>2012-09-26T19:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: calculate date-field with python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-date-field-with-python/m-p/510384#M40110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You'll need to make it a date object instead of a string I believe. Something like this maybe. (untested)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;datetime.datetime.strptime('!unsplit!.split(',')[0], "%d.%m.%Y")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2012 19:44:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-date-field-with-python/m-p/510384#M40110</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-09-26T19:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: calculate date-field with python</title>
      <link>https://community.esri.com/t5/python-questions/calculate-date-field-with-python/m-p/510385#M40111</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks a lot, Mathew.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It works fine. I was near a solution when I tested &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;datetime.strptime(!unsplit!.split(',')[0], "%d.%m.%Y")&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;before I posted that thread. It was missing one 'datetime' in the code.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2012 06:08:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculate-date-field-with-python/m-p/510385#M40111</guid>
      <dc:creator>MartinEgger</dc:creator>
      <dc:date>2012-09-27T06:08:31Z</dc:date>
    </item>
  </channel>
</rss>

