<?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: row_value  = row[cursor.fields.index(&amp;quot;LAST_UPDAT&amp;quot;)]   returns an integer in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/row-value-row-cursor-fields-index-quot-last-updat/m-p/1574402#M73519</link>
    <description>&lt;P&gt;Unfortunately, dates in cursors are handled differently between ArcGIS Desktop/ArcMap and ArcGIS Pro, so which software you are using makes a difference.&amp;nbsp; Which one are you using?&lt;/P&gt;</description>
    <pubDate>Fri, 10 Jan 2025 17:13:11 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2025-01-10T17:13:11Z</dc:date>
    <item>
      <title>row_value  = row[cursor.fields.index("LAST_UPDAT")]   returns an integer</title>
      <link>https://community.esri.com/t5/python-questions/row-value-row-cursor-fields-index-quot-last-updat/m-p/1498673#M73515</link>
      <description>&lt;P&gt;Good afternoon&lt;/P&gt;&lt;P&gt;I am trying to read this field that stores a date. It prints as an integer, I cannot convert it to a date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advise&lt;/P&gt;&lt;P&gt;with arcpy.da.SearchCursor(feature_class, ["*"],where_clause ) as cursor:&lt;BR /&gt;for row in cursor:&lt;/P&gt;&lt;P&gt;row_value = row[cursor.fields.index("LAST_UPDAT")]&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;rowdate_only = row_value.date()&amp;nbsp; &amp;nbsp; -- This fails&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 20:41:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/row-value-row-cursor-fields-index-quot-last-updat/m-p/1498673#M73515</guid>
      <dc:creator>SanchezNuñez</dc:creator>
      <dc:date>2024-06-27T20:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: row_value  = row[cursor.fields.index("LAST_UPDAT")]   returns an integer</title>
      <link>https://community.esri.com/t5/python-questions/row-value-row-cursor-fields-index-quot-last-updat/m-p/1498775#M73516</link>
      <description>&lt;P&gt;Please make use of code sample formatting for Python code to avoid indent ambiguity, like so:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;with arcpy.da.SearchCursor(feature_class, ["*"], where_clause) as cursor:
    for row in cursor:
        row_value = row[cursor.fields.index("LAST_UPDAT")]
        rowdate_only = row_value.date()  # This fails&lt;/LI-CODE&gt;&lt;P&gt;What's the data type of "LAST_UPDAT"? If it's a string you'll need to use the &lt;A href="https://docs.python.org/3.11/library/datetime.html#datetime.datetime.strptime" target="_self"&gt;this method&lt;/A&gt;, if it's an integer that represents a UNIX timestamp try something in &lt;A href="https://stackoverflow.com/questions/19801727/convert-datetime-to-unix-timestamp-and-convert-it-back-in-python" target="_self"&gt;this StackOverflow thread&lt;/A&gt;, and if it's a custom integer representation then parsing is non-trivial.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 23:40:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/row-value-row-cursor-fields-index-quot-last-updat/m-p/1498775#M73516</guid>
      <dc:creator>DavidSolari</dc:creator>
      <dc:date>2024-06-27T23:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: row_value  = row[cursor.fields.index("LAST_UPDAT")]   returns an integer</title>
      <link>https://community.esri.com/t5/python-questions/row-value-row-cursor-fields-index-quot-last-updat/m-p/1499048#M73517</link>
      <description>&lt;P&gt;Good morning &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/4413"&gt;@DavidSolari&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Environment:&lt;/P&gt;&lt;P&gt;Field Name: USERID, Field Type: Integer&lt;/P&gt;&lt;P&gt;Field Name: LAST_UPDAT, Field Type: Date,&amp;nbsp; with value&amp;nbsp;1/31/2023 4:58:00.000 PM&lt;/P&gt;&lt;P&gt;SDE database in Ms SQS Server&lt;/P&gt;&lt;P&gt;Workstation and servers running in Windows&lt;/P&gt;&lt;P&gt;I am reading records from an SDE layer located in a Ms SQL Server database, and my goal is to update the same record on a AGOL hosted feature.&amp;nbsp; &amp;nbsp;I am reading all records from SDE using arcpy.da.SearchCursor, then searching using USERID field in the hosted feature and comparing&amp;nbsp; dates using LAST_UPDAT field.&lt;/P&gt;&lt;P&gt;The compare dates does not work, something is missing.&lt;/P&gt;&lt;P&gt;My questions:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;is the field date stored in the same way in AGOL and in SDE?&amp;nbsp; I am getting an integer for SDE and a data for AGOL&lt;/LI&gt;&lt;LI&gt;Do I need to do a conversion when I store the field&amp;nbsp;LAST_UPDAT from SDE to AGOL?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 13:48:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/row-value-row-cursor-fields-index-quot-last-updat/m-p/1499048#M73517</guid>
      <dc:creator>SanchezNuñez</dc:creator>
      <dc:date>2024-06-28T13:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: row_value  = row[cursor.fields.index("LAST_UPDAT")]   returns an integer</title>
      <link>https://community.esri.com/t5/python-questions/row-value-row-cursor-fields-index-quot-last-updat/m-p/1574402#M73519</link>
      <description>&lt;P&gt;Unfortunately, dates in cursors are handled differently between ArcGIS Desktop/ArcMap and ArcGIS Pro, so which software you are using makes a difference.&amp;nbsp; Which one are you using?&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 17:13:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/row-value-row-cursor-fields-index-quot-last-updat/m-p/1574402#M73519</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2025-01-10T17:13:11Z</dc:date>
    </item>
  </channel>
</rss>

