<?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 Definition Query with dates in ArcMap Questions</title>
    <link>https://community.esri.com/t5/arcmap-questions/definition-query-with-dates/m-p/1262450#M4323</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 3 layers all pointing to one data source with different definition queries&amp;nbsp; by dates. However, someone pointed out that this can be done better as we have to change the year date every year and they said we can write a query that doesnt need changing every year, but they didnt have time to tell me what the query would be.... could anyone help?&lt;/P&gt;&lt;P&gt;Current year is anything post 1st April 2022&lt;/P&gt;&lt;P&gt;Previous year is anything between 1st April 2021 and 31st march 2022&lt;/P&gt;&lt;P&gt;Old data is 31st March 2021 and before&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These are the queries we currently have&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Current -&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;DATE_LOGGED &amp;gt;= '2022-04-01 00:00:01'&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Previous -&lt;/STRONG&gt; DATE_LOGGED &amp;gt;= '2021-04-01 00:00:00' AND DATE_LOGGED &amp;lt;= '2022-03-31 00:00:00'&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Old -&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;DATE_LOGGED &amp;lt;= '2021-03-31 00:00:00'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I write the query so that I dont have to change the year in the query every 1st April?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Laura&lt;/P&gt;</description>
    <pubDate>Tue, 28 Feb 2023 14:12:45 GMT</pubDate>
    <dc:creator>LauraBoagey1</dc:creator>
    <dc:date>2023-02-28T14:12:45Z</dc:date>
    <item>
      <title>Definition Query with dates</title>
      <link>https://community.esri.com/t5/arcmap-questions/definition-query-with-dates/m-p/1262450#M4323</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 3 layers all pointing to one data source with different definition queries&amp;nbsp; by dates. However, someone pointed out that this can be done better as we have to change the year date every year and they said we can write a query that doesnt need changing every year, but they didnt have time to tell me what the query would be.... could anyone help?&lt;/P&gt;&lt;P&gt;Current year is anything post 1st April 2022&lt;/P&gt;&lt;P&gt;Previous year is anything between 1st April 2021 and 31st march 2022&lt;/P&gt;&lt;P&gt;Old data is 31st March 2021 and before&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These are the queries we currently have&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Current -&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;DATE_LOGGED &amp;gt;= '2022-04-01 00:00:01'&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Previous -&lt;/STRONG&gt; DATE_LOGGED &amp;gt;= '2021-04-01 00:00:00' AND DATE_LOGGED &amp;lt;= '2022-03-31 00:00:00'&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Old -&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;DATE_LOGGED &amp;lt;= '2021-03-31 00:00:00'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I write the query so that I dont have to change the year in the query every 1st April?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Laura&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 14:12:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/definition-query-with-dates/m-p/1262450#M4323</guid>
      <dc:creator>LauraBoagey1</dc:creator>
      <dc:date>2023-02-28T14:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: Definition Query with dates</title>
      <link>https://community.esri.com/t5/arcmap-questions/definition-query-with-dates/m-p/1262499#M4324</link>
      <description>&lt;P&gt;SQL has a &lt;A href="https://www.w3schools.com/sql/func_sqlserver_datefromparts.asp" target="_self"&gt;DATEFROMPARTS() function&lt;/A&gt;&amp;nbsp;that could potentially work, but I don't know what your data source is.&amp;nbsp; I see you creating variables for the day and months for your different needs, and then calculating the years you need and building a date from that.&lt;/P&gt;&lt;P&gt;Here is &lt;A href="https://gis.stackexchange.com/questions/282604/using-arcgis-definition-query-for-dates" target="_self"&gt;another stack exchange article&lt;/A&gt; with a potential tip&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 15:50:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/definition-query-with-dates/m-p/1262499#M4324</guid>
      <dc:creator>Kara_Shindle</dc:creator>
      <dc:date>2023-02-28T15:50:45Z</dc:date>
    </item>
  </channel>
</rss>

