<?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: Calculating Date for ArcSDE gdb - not getting Hours, Minutes, Seconds in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/calculating-date-for-arcsde-gdb-not-getting-hours/m-p/102586#M7905</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Todd,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You could use the datetime object directly, sort of like below &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.CalculateField_management("selectLyr", "UpdDate", `datetime.datetime.now()`, "PYTHON")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Dave&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note: I'm using backtick's around the datetime when pushing it into the tool (just stating this in case that isn't obvious)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 06:19:11 GMT</pubDate>
    <dc:creator>DavidWynne</dc:creator>
    <dc:date>2021-12-11T06:19:11Z</dc:date>
    <item>
      <title>Calculating Date for ArcSDE gdb - not getting Hours, Minutes, Seconds</title>
      <link>https://community.esri.com/t5/python-questions/calculating-date-for-arcsde-gdb-not-getting-hours/m-p/102585#M7904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to calculate a date field for a feature class in an ArcSDE gdb using Python. My script successfully calculates the year, month, day but only calcs zeros for hours minutes seconds. Can you help? Here is the relevant portion of my script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import system modules&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy, os, sys&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import datetime&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;nowDate = datetime.datetime.now()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dateExp = nowDate.strftime("%Y-%m-%d %H:%M:%S")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.CalculateField_management("selectLyr", "UpdDate", "date '" + dateExp + "'", "", "")&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 May 2012 16:10:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-date-for-arcsde-gdb-not-getting-hours/m-p/102585#M7904</guid>
      <dc:creator>SaraShullaw</dc:creator>
      <dc:date>2012-05-07T16:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Date for ArcSDE gdb - not getting Hours, Minutes, Seconds</title>
      <link>https://community.esri.com/t5/python-questions/calculating-date-for-arcsde-gdb-not-getting-hours/m-p/102586#M7905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Todd,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You could use the datetime object directly, sort of like below &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.CalculateField_management("selectLyr", "UpdDate", `datetime.datetime.now()`, "PYTHON")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Dave&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note: I'm using backtick's around the datetime when pushing it into the tool (just stating this in case that isn't obvious)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:19:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-date-for-arcsde-gdb-not-getting-hours/m-p/102586#M7905</guid>
      <dc:creator>DavidWynne</dc:creator>
      <dc:date>2021-12-11T06:19:11Z</dc:date>
    </item>
  </channel>
</rss>

