<?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: Cannot Use Timestamp for Where Clause in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/cannot-use-timestamp-for-where-clause/m-p/1499899#M70954</link>
    <description>&lt;P&gt;Here's a living atlas layer:&lt;/P&gt;&lt;P data-unlink="true"&gt;https://services9.arcgis.com/RHVPKKiFTONKtxq3/ArcGIS/rest/services/USA_Wildfires_v1/FeatureServer/0/query?where=FireDiscoveryDateTime+&amp;gt;+TIMESTAMP+'2024-01-01+00%3A00%3A00'&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it as simple as putting TIMESTAMP in all caps? I haven't known it to be case-sensitive in the past, but if yours isn't working, I'm at a loss. It's a DateTime field, not a Date Only?&lt;/P&gt;</description>
    <pubDate>Mon, 01 Jul 2024 15:21:21 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2024-07-01T15:21:21Z</dc:date>
    <item>
      <title>Cannot Use Timestamp for Where Clause</title>
      <link>https://community.esri.com/t5/python-questions/cannot-use-timestamp-for-where-clause/m-p/1499813#M70944</link>
      <description>&lt;P&gt;Hey All,&lt;/P&gt;&lt;P&gt;I'm attempting to query a feature layer using the ArcGIS API for Python, and when using the where clause for a timestamp, I'm getting met with errors, even though it's validating within Select By Attributes in Pro.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;where = 'EditDate &amp;lt; timestamp \'2024-06-28 00:00:00.000\''&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CodyPatterson_0-1719841114144.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/108461iFF243DC82495F7EA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CodyPatterson_0-1719841114144.png" alt="CodyPatterson_0-1719841114144.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CodyPatterson_1-1719841121728.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/108462i9BCB30FEC2E10022/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CodyPatterson_1-1719841121728.png" alt="CodyPatterson_1-1719841121728.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CodyPatterson_2-1719841158251.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/108463iCD8615451512E0C3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CodyPatterson_2-1719841158251.png" alt="CodyPatterson_2-1719841158251.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have attempted everything in this link, but none have worked, very confused on where I am going wrong here: &lt;A href="https://community.esri.com/t5/arcgis-api-for-python-questions/querying-a-date-field-on-a-feature-layer/td-p/852126" target="_blank"&gt;https://community.esri.com/t5/arcgis-api-for-python-questions/querying-a-date-field-on-a-feature-layer/td-p/852126&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 13:41:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-use-timestamp-for-where-clause/m-p/1499813#M70944</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2024-07-01T13:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot Use Timestamp for Where Clause</title>
      <link>https://community.esri.com/t5/python-questions/cannot-use-timestamp-for-where-clause/m-p/1499815#M70945</link>
      <description>&lt;P&gt;Try putting the whole thing in double quotes?&lt;/P&gt;&lt;P&gt;"EditDate &amp;lt; timestamp '2024-06-28 00:00:00'"&lt;/P&gt;&lt;P&gt;The SQL expression might be valid, but timestamp formatting will depend on the underlying database. Where is the data coming from? Postgres? MSSQL? A file?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 13:44:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-use-timestamp-for-where-clause/m-p/1499815#M70945</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-07-01T13:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot Use Timestamp for Where Clause</title>
      <link>https://community.esri.com/t5/python-questions/cannot-use-timestamp-for-where-clause/m-p/1499821#M70947</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just attempted that with no success unfortunately, this is coming from AGOL through their Hosted Feature Layers, I'm not entirely confident in the DB behind it unfortunately.&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 13:50:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-use-timestamp-for-where-clause/m-p/1499821#M70947</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2024-07-01T13:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot Use Timestamp for Where Clause</title>
      <link>https://community.esri.com/t5/python-questions/cannot-use-timestamp-for-where-clause/m-p/1499826#M70949</link>
      <description>&lt;P&gt;Any chance the service is public? I would be curious to attempt a query.&lt;/P&gt;&lt;P&gt;According to the REST API docs, you're formatting it fine…&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/rest/services-reference/enterprise/query-feature-service/#date-time-queries" target="_blank"&gt;https://developers.arcgis.com/rest/services-reference/enterprise/query-feature-service/#date-time-queries&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 13:55:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-use-timestamp-for-where-clause/m-p/1499826#M70949</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-07-01T13:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot Use Timestamp for Where Clause</title>
      <link>https://community.esri.com/t5/python-questions/cannot-use-timestamp-for-where-clause/m-p/1499868#M70951</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This service currently isn't public unfortunately, it has proprietary information and could not be shared that way, but if there is a public service you are aware of, I can definitely retry the query, or create my own that is blank that I could test with or send over to test with!&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 14:40:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-use-timestamp-for-where-clause/m-p/1499868#M70951</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2024-07-01T14:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot Use Timestamp for Where Clause</title>
      <link>https://community.esri.com/t5/python-questions/cannot-use-timestamp-for-where-clause/m-p/1499899#M70954</link>
      <description>&lt;P&gt;Here's a living atlas layer:&lt;/P&gt;&lt;P data-unlink="true"&gt;https://services9.arcgis.com/RHVPKKiFTONKtxq3/ArcGIS/rest/services/USA_Wildfires_v1/FeatureServer/0/query?where=FireDiscoveryDateTime+&amp;gt;+TIMESTAMP+'2024-01-01+00%3A00%3A00'&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it as simple as putting TIMESTAMP in all caps? I haven't known it to be case-sensitive in the past, but if yours isn't working, I'm at a loss. It's a DateTime field, not a Date Only?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 15:21:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-use-timestamp-for-where-clause/m-p/1499899#M70954</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-07-01T15:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot Use Timestamp for Where Clause</title>
      <link>https://community.esri.com/t5/python-questions/cannot-use-timestamp-for-where-clause/m-p/1499926#M70955</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That worked perfectly fine in a GET request using the API, but unfortunately it did not work at all when I used it with the query(where={where clause}) function, I'm assuming it's not converting into URLEncoded parameters, what I may do is just use a URLEncoder to attempt and just build the GET request over the URL. I reformatted my original request in that format you have in the URL, and it seems to have worked, but this will require a ton of rewrite for what information it's looking for. Very odd that it doesn't work on the query function!&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 15:58:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-use-timestamp-for-where-clause/m-p/1499926#M70955</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2024-07-01T15:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot Use Timestamp for Where Clause</title>
      <link>https://community.esri.com/t5/python-questions/cannot-use-timestamp-for-where-clause/m-p/1499931#M70956</link>
      <description>&lt;P&gt;I hate to say this, but… it works fine over here.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1719850086026.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/108479i725A91C368CA174A/image-size/large?v=v2&amp;amp;px=999" role="button" title="jcarlson_0-1719850086026.png" alt="jcarlson_0-1719850086026.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 16:08:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-use-timestamp-for-where-clause/m-p/1499931#M70956</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-07-01T16:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot Use Timestamp for Where Clause</title>
      <link>https://community.esri.com/t5/python-questions/cannot-use-timestamp-for-where-clause/m-p/1499968#M70958</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've figured it out, your example worked just fine with mine, as soon as I took out the out_fields. There was an invalid field within the query, specifically SHAPE was represented as SHAPE@ and I just assumed it was right. I went through and found it and once fixed, everything started going well. I'll put in an idea to possibly add a notice for when the fields are invalid rather than having a very lacking error message!&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 17:30:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-use-timestamp-for-where-clause/m-p/1499968#M70958</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2024-07-01T17:30:49Z</dc:date>
    </item>
  </channel>
</rss>

