<?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: Select for Today in Arcade when data is in local time in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/select-for-today-in-arcade-when-data-is-in-local/m-p/1248333#M49790</link>
    <description>&lt;P&gt;I think I am getting closer to what I wanted.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;I had to get just the date part of today.&lt;/P&gt;&lt;P&gt;2023-01-14T00:00:00-07:00 with the Text Function&lt;/P&gt;&lt;P&gt;var dispatch = $feature.dispatch_date&lt;/P&gt;&lt;P&gt;var Today = Date(Text(now, "Y-MM-DD"))&lt;/P&gt;&lt;P&gt;If (dispatch &amp;gt; Today)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'today'&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'past'&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mele&lt;/P&gt;</description>
    <pubDate>Sat, 14 Jan 2023 16:40:12 GMT</pubDate>
    <dc:creator>MeleKoneya</dc:creator>
    <dc:date>2023-01-14T16:40:12Z</dc:date>
    <item>
      <title>Select for Today in Arcade when data is in local time</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/select-for-today-in-arcade-when-data-is-in-local/m-p/1248269#M49782</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I published a feature layer to AGOL via ArcGIS pro and see in the data panel that our times are in local time which is what I wanted.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I am trying to grab only today's records using this:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;time&lt;/SPAN&gt;&lt;SPAN&gt; = -&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;units&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;'days'&lt;/SPAN&gt;&lt;SPAN&gt; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;//milliseconds, seconds, minutes, hours, days, months, years&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;dateField&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"Today"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;pastDate&lt;/SPAN&gt;&lt;SPAN&gt; = &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;DateAdd&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Date&lt;/SPAN&gt;&lt;SPAN&gt;(), &lt;/SPAN&gt;&lt;SPAN&gt;time&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;units&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;dispatch_date&lt;/SPAN&gt;&lt;SPAN&gt; &amp;gt; &lt;/SPAN&gt;&lt;SPAN&gt;pastDate&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;dateField&lt;/SPAN&gt;&lt;SPAN&gt; &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;The results are close to what I would expect 110 records, but it really should be 75.&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I am guessing it is doing some UTC assumptions on my dates, but I am lost as to how to fake it to use the stored value which is local as far as I can tell since I published it that way.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Mele&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 13 Jan 2023 23:25:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/select-for-today-in-arcade-when-data-is-in-local/m-p/1248269#M49782</guid>
      <dc:creator>MeleKoneya</dc:creator>
      <dc:date>2023-01-13T23:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Select for Today in Arcade when data is in local time</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/select-for-today-in-arcade-when-data-is-in-local/m-p/1248309#M49786</link>
      <description>&lt;P&gt;The following expression converts UTC date to to Local Date. Replace Timestamp() with your date variable.&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;ToLocal(Timestamp())&lt;/LI-CODE&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/arcade/function-reference/date_functions/#tolocal" target="_blank"&gt;https://developers.arcgis.com/arcade/function-reference/date_functions/#tolocal&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jan 2023 05:22:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/select-for-today-in-arcade-when-data-is-in-local/m-p/1248309#M49786</guid>
      <dc:creator>JayantaPoddar</dc:creator>
      <dc:date>2023-01-14T05:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: Select for Today in Arcade when data is in local time</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/select-for-today-in-arcade-when-data-is-in-local/m-p/1248333#M49790</link>
      <description>&lt;P&gt;I think I am getting closer to what I wanted.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;I had to get just the date part of today.&lt;/P&gt;&lt;P&gt;2023-01-14T00:00:00-07:00 with the Text Function&lt;/P&gt;&lt;P&gt;var dispatch = $feature.dispatch_date&lt;/P&gt;&lt;P&gt;var Today = Date(Text(now, "Y-MM-DD"))&lt;/P&gt;&lt;P&gt;If (dispatch &amp;gt; Today)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'today'&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'past'&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mele&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jan 2023 16:40:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/select-for-today-in-arcade-when-data-is-in-local/m-p/1248333#M49790</guid>
      <dc:creator>MeleKoneya</dc:creator>
      <dc:date>2023-01-14T16:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Select for Today in Arcade when data is in local time</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/select-for-today-in-arcade-when-data-is-in-local/m-p/1248342#M49793</link>
      <description>&lt;P&gt;Assuming the dispatch_date field also has Date datatype, you can check the following expression&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;var dispatch = $feature.dispatch_date

var dispatchdate = Concatenate(Year(dispatch),'-',Month(dispatch)+1,'-',Day(dispatch))

var currentdate = Concatenate(Year(Today()),'-',Month(Today())+1,'-',Day(Today()))

If (dispatchdate == currentdate)

{

  'today'

}

else

{

  'past'

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jan 2023 19:49:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/select-for-today-in-arcade-when-data-is-in-local/m-p/1248342#M49793</guid>
      <dc:creator>JayantaPoddar</dc:creator>
      <dc:date>2023-01-14T19:49:28Z</dc:date>
    </item>
  </channel>
</rss>

