<?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: Proper REST query for epoch in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/proper-rest-query-for-epoch/m-p/487863#M45382</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Update:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like any datetime queries against a hosted feature service on AGOL should be based on GMT time.&amp;nbsp; There are some little things that can throw you off if not careful, for example it appears that adding the hosted feature service to a webmap viewer and applying queries with the built-in query builder will automatically adjust to your local time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, because I'm applying queries directly against the REST service query task, I need to make sure my input datetime values have been converted to GMT first.&amp;nbsp; I can't just assume that my desired query will work to return a result of all features on January 31, 2020:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;timestampField BETWEEN TIMESTAMP '2020-01-31 00:00:00' AND TIMESTAMP '2020-01-31 23:59:59'&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is because GMT vs. my local time (Eastern) must account for a 05:00:00 difference and would need to be applied as this to return the desired result:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;location_timestamp BETWEEN TIMESTAMP '2020-01-31 05:00:00' AND TIMESTAMP '2020-02-01 04:59:59'&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This was validated against a feature service with known edit datetimes and a query based upon a very short time range, but please jump in and disagree or show me where I'm wrong!&amp;nbsp; Please!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's what's in the webmap viewer.&amp;nbsp; The OID's labelled are reflecting what I want to query, where the middle point of the 3 point features is the desired result so my query should return feature oid 91823:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/482442_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the REST query task.&amp;nbsp; The full query is converted to GMT from my localtime (look at the popup of the middle point is 2020-02-07 13:23:56 so I should return 1 feature with this query "location_timestamp BETWEEN TIMESTAMP '2020-02-07 18:23:55' AND TIMESTAMP '2020-02-07 18:23:58'"):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/482443_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the REST query result: 1 feature and the OID matches!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/482447_pastedImage_3.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Feb 2020 18:47:20 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2020-02-17T18:47:20Z</dc:date>
    <item>
      <title>Proper REST query for epoch</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/proper-rest-query-for-epoch/m-p/487861#M45380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Trying to query a hosted feature service on its timestamp field (epoch format, long integer) by passing in a TIMESTAMP value.&amp;nbsp; Using this Where clause on the service query interface,&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;DIV&gt;timestampField BETWEEN TIMESTAMP '2020-01-31 00:00:00' AND TIMESTAMP '2020-01-31 23:59:59'&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;However, it is returning features with a timestampField = &lt;STRONG&gt;1580435690994&lt;/STRONG&gt; (epoch) which is:&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;DIV&gt;GMT: Friday, January 31, 2020 1:54:50.994&lt;BR /&gt;Your time zone: Thursday, January 30, 2020 20:54:50.994 GMT-05:00&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;So, I'm unsure to properly query this service using the input datetime values.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2020 15:29:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/proper-rest-query-for-epoch/m-p/487861#M45380</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2020-02-04T15:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: Proper REST query for epoch</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/proper-rest-query-for-epoch/m-p/487862#M45381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So it appears that I should not include a timestamp on the input dates and simply format as yyyy-mm-dd then just allow the service to pick between midnight.&amp;nbsp; Therefore in order to return all features on 2020-01-31 the correct query should be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;timestampField BETWEEN '2020-01-31' AND '2020-02-01'&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please comment if you see differently.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2020 16:48:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/proper-rest-query-for-epoch/m-p/487862#M45381</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2020-02-04T16:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: Proper REST query for epoch</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/proper-rest-query-for-epoch/m-p/487863#M45382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Update:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like any datetime queries against a hosted feature service on AGOL should be based on GMT time.&amp;nbsp; There are some little things that can throw you off if not careful, for example it appears that adding the hosted feature service to a webmap viewer and applying queries with the built-in query builder will automatically adjust to your local time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, because I'm applying queries directly against the REST service query task, I need to make sure my input datetime values have been converted to GMT first.&amp;nbsp; I can't just assume that my desired query will work to return a result of all features on January 31, 2020:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;timestampField BETWEEN TIMESTAMP '2020-01-31 00:00:00' AND TIMESTAMP '2020-01-31 23:59:59'&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is because GMT vs. my local time (Eastern) must account for a 05:00:00 difference and would need to be applied as this to return the desired result:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;location_timestamp BETWEEN TIMESTAMP '2020-01-31 05:00:00' AND TIMESTAMP '2020-02-01 04:59:59'&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This was validated against a feature service with known edit datetimes and a query based upon a very short time range, but please jump in and disagree or show me where I'm wrong!&amp;nbsp; Please!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's what's in the webmap viewer.&amp;nbsp; The OID's labelled are reflecting what I want to query, where the middle point of the 3 point features is the desired result so my query should return feature oid 91823:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/482442_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the REST query task.&amp;nbsp; The full query is converted to GMT from my localtime (look at the popup of the middle point is 2020-02-07 13:23:56 so I should return 1 feature with this query "location_timestamp BETWEEN TIMESTAMP '2020-02-07 18:23:55' AND TIMESTAMP '2020-02-07 18:23:58'"):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/482443_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the REST query result: 1 feature and the OID matches!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/482447_pastedImage_3.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Feb 2020 18:47:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/proper-rest-query-for-epoch/m-p/487863#M45382</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2020-02-17T18:47:20Z</dc:date>
    </item>
  </channel>
</rss>

