<?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 Query feature service via REST, where DateTime now is less than some factor in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/query-feature-service-via-rest-where-datetime-now/m-p/435051#M21979</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to figure out how to filter features that are showing up in a map based on when they were last edited. &amp;nbsp;All of the documentation I have been able to find says that this can't be done in ArcGIS Online or Portal (which is where I'm trying to build the map). &amp;nbsp;What I'd like to do is simply filter the features down to just those that were edited in the last 3 hours,&amp;nbsp;based on the last_edited_date in the data. &amp;nbsp;In SQL, I would just do this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;last_edited_date &amp;gt; DATEADD(hh,-3,GETDATE())&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...but this doesn't work. &amp;nbsp;Is there a way to do this via the REST endpoint?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm thinking that if I can figure out how to set the where clause correctly, I can take the service URL with the where clause, plug it into a map in AGOL, set a refresh on the layer, and boom... done.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any thoughts on how to construct the ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 May 2017 18:54:32 GMT</pubDate>
    <dc:creator>NickO_Day</dc:creator>
    <dc:date>2017-05-02T18:54:32Z</dc:date>
    <item>
      <title>Query feature service via REST, where DateTime now is less than some factor</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/query-feature-service-via-rest-where-datetime-now/m-p/435051#M21979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to figure out how to filter features that are showing up in a map based on when they were last edited. &amp;nbsp;All of the documentation I have been able to find says that this can't be done in ArcGIS Online or Portal (which is where I'm trying to build the map). &amp;nbsp;What I'd like to do is simply filter the features down to just those that were edited in the last 3 hours,&amp;nbsp;based on the last_edited_date in the data. &amp;nbsp;In SQL, I would just do this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;last_edited_date &amp;gt; DATEADD(hh,-3,GETDATE())&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...but this doesn't work. &amp;nbsp;Is there a way to do this via the REST endpoint?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm thinking that if I can figure out how to set the where clause correctly, I can take the service URL with the where clause, plug it into a map in AGOL, set a refresh on the layer, and boom... done.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any thoughts on how to construct the ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 May 2017 18:54:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/query-feature-service-via-rest-where-datetime-now/m-p/435051#M21979</guid>
      <dc:creator>NickO_Day</dc:creator>
      <dc:date>2017-05-02T18:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: Query feature service via REST, where DateTime now is less than some factor</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/query-feature-service-via-rest-where-datetime-now/m-p/435052#M21980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Nick,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Take a look at the following document:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/docs/DOC-8191"&gt;https://community.esri.com/docs/DOC-8191&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 May 2017 19:19:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/query-feature-service-via-rest-where-datetime-now/m-p/435052#M21980</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2017-05-02T19:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: Query feature service via REST, where DateTime now is less than some factor</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/query-feature-service-via-rest-where-datetime-now/m-p/435053#M21981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jake,&lt;/P&gt;&lt;P&gt;Thanks for the link! &amp;nbsp;This worked pretty easily... since I'm building this on a local Portal, I had to go into the Server Admin settings to flip the switch on allowing non-standard SQL first (which updated the change into the Portal). &amp;nbsp;Then I restructured the definition query to a BETWEEN instead of what I originally had and it all worked. &amp;nbsp;Here's the new query that works perfectly:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;last_edited_date BETWEEN convert(CURRENT_TIMESTAMP()-0.125) AND convert(CURRENT_TIMESTAMP())&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: The "-0.125" part is 3 hours (or 3/24, or 1/8 of a day). &amp;nbsp;I also changed from &lt;CODE&gt;GETDATE&lt;/CODE&gt; to &lt;CODE&gt;CURRENT_TIMESTAMP&lt;/CODE&gt; to avoid a mismatch of timezones between when the feature is edited (since it streams in via GeoEvent and features are automatically tagged in UTC) and the current timezone that I'm in (which is EST, not UTC... &lt;CODE&gt;CURRENT_TIMESTAMP&lt;/CODE&gt; returns UTC. &amp;nbsp;Just posting this in case someone else needs to reverse engineer the solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 May 2017 22:13:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/query-feature-service-via-rest-where-datetime-now/m-p/435053#M21981</guid>
      <dc:creator>NickO_Day</dc:creator>
      <dc:date>2017-05-02T22:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: Query feature service via REST, where DateTime now is less than some factor</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/query-feature-service-via-rest-where-datetime-now/m-p/435054#M21982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also this helpful blog:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://www.esri.com/arcgis-blog/products/api-rest/data-management/querying-feature-services-date-time-queries/" title="https://www.esri.com/arcgis-blog/products/api-rest/data-management/querying-feature-services-date-time-queries/"&gt;Querying Feature Services: Date-Time Queries&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jul 2020 16:31:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/query-feature-service-via-rest-where-datetime-now/m-p/435054#M21982</guid>
      <dc:creator>AndresCastillo</dc:creator>
      <dc:date>2020-07-29T16:31:47Z</dc:date>
    </item>
  </channel>
</rss>

