<?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: date between query not working in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/date-between-query-not-working/m-p/1073951#M3905</link>
    <description>&lt;P&gt;Figured it out. BETWEEN is not inclusive but exclusive.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Jun 2021 23:51:52 GMT</pubDate>
    <dc:creator>AmeWunderle</dc:creator>
    <dc:date>2021-06-29T23:51:52Z</dc:date>
    <item>
      <title>date between query not working</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/date-between-query-not-working/m-p/1073755#M3904</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am accessing the REST API using Python to auto-run and download feature reports from Survey123. This works beautifully when I run it daily, however, as there are times when we have power outages, I wanted it to run based on the last edit date and today (so querying all surveys within a range).&amp;nbsp;&lt;/P&gt;&lt;P&gt;My original query is formatted (which works in my script):&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;starttime&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;datetime&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;datetime&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;now&lt;/SPAN&gt;&lt;SPAN&gt;().&lt;/SPAN&gt;&lt;SPAN&gt;strftime&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'%Y-%m-&lt;/SPAN&gt;&lt;SPAN&gt;%d&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"{&lt;/SPAN&gt;&lt;SPAN&gt;\"&lt;/SPAN&gt;&lt;SPAN&gt;where&lt;/SPAN&gt;&lt;SPAN&gt;\"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;\"&lt;/SPAN&gt;&lt;SPAN&gt;EditDate&amp;nbsp;&amp;gt;=&amp;nbsp;DATE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;\'&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN&gt;starttime&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN&gt;"'&lt;/SPAN&gt;&lt;SPAN&gt;\"&lt;/SPAN&gt;&lt;SPAN&gt;}"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;printed it looks like {"where":"EditDate &amp;gt;= DATE '2021-06-28'"}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;When I run my script I write the starttime to a json. The next time the script runs it grabs the starttime+1 day (so I don't get multiple entries). So based on the Date Blog I read using REST API&amp;nbsp;@(&lt;A href="https://www.esri.com/arcgis-blog/products/api-rest/data-management/querying-feature-services-date-time-queries/" target="_blank" rel="noopener"&gt;https://www.esri.com/arcgis-blog/products/api-rest/data-management/querying-feature-services-date-time-queries/&lt;/A&gt;)&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Query 2 = &lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"{&lt;/SPAN&gt;&lt;SPAN&gt;\"&lt;/SPAN&gt;&lt;SPAN&gt;where&lt;/SPAN&gt;&lt;SPAN&gt;\"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;\"&lt;/SPAN&gt;&lt;SPAN&gt;EditDate&amp;nbsp;BETWEEN&amp;nbsp;DATE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;\'&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN&gt;strlastPlusOne&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;\'&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;AND&amp;nbsp;DATE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;\'&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN&gt;starttime&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;\'\"&lt;/SPAN&gt;&lt;SPAN&gt;}"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;which printed looks like {"where":"EditDate BETWEEN DATE '2021-06-28' AND DATE '2021-06-29'"}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;but it isn't working though after the Dev conference when I was working on it and testing with other ranges, I swear it did....anyone see anything obvious as to why this query wouldn't work? I only receive the error that there is no record in the query result although there is a survey submitted for 2021-06-28.&amp;nbsp; I also tested this using different test dates widening the range from 2021-06-27 to 2021-06-29, same result. When I run with the original query for the date '2021-06-28' it works.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 29 Jun 2021 15:57:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/date-between-query-not-working/m-p/1073755#M3904</guid>
      <dc:creator>AmeWunderle</dc:creator>
      <dc:date>2021-06-29T15:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: date between query not working</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/date-between-query-not-working/m-p/1073951#M3905</link>
      <description>&lt;P&gt;Figured it out. BETWEEN is not inclusive but exclusive.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 23:51:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/date-between-query-not-working/m-p/1073951#M3905</guid>
      <dc:creator>AmeWunderle</dc:creator>
      <dc:date>2021-06-29T23:51:52Z</dc:date>
    </item>
  </channel>
</rss>

