<?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: CalculateField - date field with Python expression in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/calculatefield-date-field-with-python-expression/m-p/7479#M285</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Steve,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure where you're going wrong exactly? Do you need Python syntax for time?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import time
print time.strftime("%Y/%m/%d %H:%M:%S", time.localtime())
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Will give:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2010/06/11 11:34:14&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you bring this into your calc script?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 20:18:37 GMT</pubDate>
    <dc:creator>KevinHibma</dc:creator>
    <dc:date>2021-12-10T20:18:37Z</dc:date>
    <item>
      <title>CalculateField - date field with Python expression</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculatefield-date-field-with-python-expression/m-p/7478#M284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am writing a Python script that ultimately will be in a ArcGIS Server geoprocessing service.&amp;nbsp; A date field in a file GDB feature class needs to be populated with the current date.&amp;nbsp; Expression type must be Python according to the tool documentation because this will be a service (otherwise I'd be done by now with the VB expression "Date()"...).&amp;nbsp; My attempts have gone in circles for long enough - can anyone share a way to do this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jun 2010 16:25:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculatefield-date-field-with-python-expression/m-p/7478#M284</guid>
      <dc:creator>SteveSalas</dc:creator>
      <dc:date>2010-06-16T16:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: CalculateField - date field with Python expression</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculatefield-date-field-with-python-expression/m-p/7479#M285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Steve,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure where you're going wrong exactly? Do you need Python syntax for time?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import time
print time.strftime("%Y/%m/%d %H:%M:%S", time.localtime())
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Will give:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2010/06/11 11:34:14&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you bring this into your calc script?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:18:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculatefield-date-field-with-python-expression/m-p/7479#M285</guid>
      <dc:creator>KevinHibma</dc:creator>
      <dc:date>2021-12-10T20:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: CalculateField - date field with Python expression</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculatefield-date-field-with-python-expression/m-p/7480#M286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks, that was just the hint I needed - I don't think I tried YYYY/MM/DD in nested quotes...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.CalculateField_management("TEST_POLY","CREATE_DATE","'2007/01/01'","PYTHON_9.3")&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jun 2010 19:14:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculatefield-date-field-with-python-expression/m-p/7480#M286</guid>
      <dc:creator>SteveSalas</dc:creator>
      <dc:date>2010-06-16T19:14:25Z</dc:date>
    </item>
  </channel>
</rss>

