<?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: Creating a list of unique dates in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/creating-a-list-of-unique-dates/m-p/1643247#M11369</link>
    <description>&lt;P&gt;You can use a SQL expression in the Distinct function&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = FeatureSetByPortalItem(Portal('https://xyzx.arcgis.com/'), 'xyzxyzx', 0, ['StartDateTime'], false);
return Distinct(fs,{
  name: "StartDateTime",
  expression: "CAST(StartDateTime as DATE)"
})&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;However, if your dates are in the Western Hemisphere, then you have to add the correct number of hours to correct for the UTC offset.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = FeatureSetByPortalItem(Portal('https://xyzx.arcgis.com/'), 'xyzxyzx', 0, ['StartDateTime'], false);
var dates = Distinct(fs,{
  name: "StartDateTime",
  expression: "CAST(StartDateTime as DATE)"
});
var features = [];
var fields = [{ name: "Date", type: "esriFieldTypeDate" }];
for (var d in dates) {
  Push(features, { attributes: { Date: DateAdd(d.StartDateTime, 4, "hours") } }); //I'm in the US Eastern Time Zone, so I have to add 4 hours
}
return FeatureSet({ fields: fields, features: features });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Aug 2025 13:28:31 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2025-08-19T13:28:31Z</dc:date>
    <item>
      <title>Creating a list of unique dates</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/creating-a-list-of-unique-dates/m-p/1643206#M11367</link>
      <description>&lt;P&gt;Hi, I am trying to create a list item that just shows the unique dates from a "StartDateTime" field in my layer. I have been able to do this if I reformat the date field to a string field but then the dates in the list are sorted numerically rather than in date order (e.g. all the 1st of each month at the top of the list etc).&lt;/P&gt;&lt;P&gt;My date field however is a date/time field and I'm struggling to work out how to remove the time part so I can just group by/show the unique dates.&lt;/P&gt;&lt;P&gt;I've so far tried this by creating a data expression, with the basic expression below. If anyone could provide help on how to edit this so it only brings back the unique dates (excluding the times) I would be very grateful. Or if there is some other way to do this e.g. through Advance formatting?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;fs&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;FeatureSetByPortalItem&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Portal&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;A href="https://xyzx.arcgis.com/" target="_blank"&gt;https://xyzx.arcgis.com/&lt;/A&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;'xyzxyzx'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;, [&lt;/SPAN&gt;&lt;SPAN&gt;'StartDateTime'&lt;/SPAN&gt;&lt;SPAN&gt;], &lt;/SPAN&gt;&lt;SPAN&gt;false&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;Distinct&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;fs&lt;/SPAN&gt;&lt;SPAN&gt;,[&lt;/SPAN&gt;&lt;SPAN&gt;'StartDateTime'&lt;/SPAN&gt;&lt;SPAN&gt;]);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 19 Aug 2025 11:21:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/creating-a-list-of-unique-dates/m-p/1643206#M11367</guid>
      <dc:creator>KatieQuantrell</dc:creator>
      <dc:date>2025-08-19T11:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list of unique dates</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/creating-a-list-of-unique-dates/m-p/1643216#M11368</link>
      <description>&lt;P&gt;If all you are needing is the date values, you can read each date value and parse it into its individual parts then add those as a new date item to an array. Then take the distinct values from that array.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = FeatureSetByPortalItem();

var dates = [];
var month;
var day;
var year;

for(var f in fs){
  month = Month(f['StartDateTime']);
  day = Day(f['StartDateTime']);
  year = Year(f['StartDateTime']);
  push(dates, Date(year, month, date))
}

return Distinct(dates)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 19 Aug 2025 12:21:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/creating-a-list-of-unique-dates/m-p/1643216#M11368</guid>
      <dc:creator>AustinAverill</dc:creator>
      <dc:date>2025-08-19T12:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list of unique dates</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/creating-a-list-of-unique-dates/m-p/1643247#M11369</link>
      <description>&lt;P&gt;You can use a SQL expression in the Distinct function&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = FeatureSetByPortalItem(Portal('https://xyzx.arcgis.com/'), 'xyzxyzx', 0, ['StartDateTime'], false);
return Distinct(fs,{
  name: "StartDateTime",
  expression: "CAST(StartDateTime as DATE)"
})&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;However, if your dates are in the Western Hemisphere, then you have to add the correct number of hours to correct for the UTC offset.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = FeatureSetByPortalItem(Portal('https://xyzx.arcgis.com/'), 'xyzxyzx', 0, ['StartDateTime'], false);
var dates = Distinct(fs,{
  name: "StartDateTime",
  expression: "CAST(StartDateTime as DATE)"
});
var features = [];
var fields = [{ name: "Date", type: "esriFieldTypeDate" }];
for (var d in dates) {
  Push(features, { attributes: { Date: DateAdd(d.StartDateTime, 4, "hours") } }); //I'm in the US Eastern Time Zone, so I have to add 4 hours
}
return FeatureSet({ fields: fields, features: features });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Aug 2025 13:28:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/creating-a-list-of-unique-dates/m-p/1643247#M11369</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2025-08-19T13:28:31Z</dc:date>
    </item>
  </channel>
</rss>

