<?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: syntax to query a featureLayer using date field with Arcgis JS api? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/syntax-to-query-a-featurelayer-using-date-field/m-p/242458#M22460</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dates values are in Epoch format so you'll need to specify your date value as such. If you have your date of interest as a variable, then the Epoch value of that date would be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_1423068443264280 jive_text_macro" jivemacro_uid="_1423068443264280"&gt;&lt;P&gt;var epochDate = theDate.getTime() / 1000;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your query then should be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14230684573535864 jive_text_macro" jivemacro_uid="_14230684573535864"&gt;&lt;P&gt;"date_created &amp;gt; " + epochDate&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is untested, though..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Feb 2015 16:48:43 GMT</pubDate>
    <dc:creator>SteveCole</dc:creator>
    <dc:date>2015-02-04T16:48:43Z</dc:date>
    <item>
      <title>syntax to query a featureLayer using date field with Arcgis JS api?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/syntax-to-query-a-featurelayer-using-date-field/m-p/242457#M22459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i have a featureLayer in my JS map, (snapshot_mode), I can make queries on the layer as below (so my issue is specifically how query the layer based on a date field e.g. show all features newer than 01/01/2014) - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; featurelayer.setDefinitionExpression("status = 0"); // for example this is working
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have looked through the documentation, however no success... I am unable to query the layer based on a date field, &lt;BR /&gt;I have tried both a static ("date_created &amp;gt; 2014-01-01") as well as passing in a js date variable - "new date(...) and a couple of others, &lt;BR /&gt;I also saw there is a setTimeDefinition, which I also attempted to use, but still an unsuccessful outcome,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;so, any advice on how to filter by date will be very much appreciated,&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:08:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/syntax-to-query-a-featurelayer-using-date-field/m-p/242457#M22459</guid>
      <dc:creator>JohnSnow3</dc:creator>
      <dc:date>2021-12-11T12:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: syntax to query a featureLayer using date field with Arcgis JS api?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/syntax-to-query-a-featurelayer-using-date-field/m-p/242458#M22460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dates values are in Epoch format so you'll need to specify your date value as such. If you have your date of interest as a variable, then the Epoch value of that date would be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_1423068443264280 jive_text_macro" jivemacro_uid="_1423068443264280"&gt;&lt;P&gt;var epochDate = theDate.getTime() / 1000;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your query then should be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14230684573535864 jive_text_macro" jivemacro_uid="_14230684573535864"&gt;&lt;P&gt;"date_created &amp;gt; " + epochDate&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is untested, though..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2015 16:48:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/syntax-to-query-a-featurelayer-using-date-field/m-p/242458#M22460</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2015-02-04T16:48:43Z</dc:date>
    </item>
  </channel>
</rss>

