<?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: Date-Range Domains - what gives in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/date-range-domains-what-gives/m-p/1602924#M73988</link>
    <description>&lt;P&gt;Writing a follow up here in case the information might help someone else who stumbles on this post like I did.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For doing this in code, here is an example of code that worked for me:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.management.SetValueForRangeDomain(
    in_workspace=r"PATH TO YOUR DATABASE",
    domain_name="DateRange",
    min_value="1/1/1900 12:00:00 AM",
    max_value="1/1/2100 12:00:00 AM"
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And if you want to do it in the GUI, if the Field Type is "Date" and the Domain Type is "Range Domain", then when you click within the Minimum or Maximum cells, there will be a GUI calendar input where you can select the date.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Katie_Clark_0-1743791279169.png" style="width: 748px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129529i45491223F383EB2B/image-dimensions/748x124?v=v2" width="748" height="124" role="button" title="Katie_Clark_0-1743791279169.png" alt="Katie_Clark_0-1743791279169.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Apr 2025 18:29:05 GMT</pubDate>
    <dc:creator>Katie_Clark</dc:creator>
    <dc:date>2025-04-04T18:29:05Z</dc:date>
    <item>
      <title>Date-Range Domains - what gives</title>
      <link>https://community.esri.com/t5/python-questions/date-range-domains-what-gives/m-p/88376#M6873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could use some help understanding Range Domains configured to use the 'Date' field type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 1. In ArcGIS Pro, I created a new Range Domain in a file gdb configured to use the Date field type.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;fgdb &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Users\johnmdye\Documents\ArcGIS\Projects\MyProject.gdb"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CreateDomain_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; fgdb&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'DateDomain'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'My Date-Range Domain'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'DATE'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'RANGE'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 2. Next, I set the Range Domain values. I checked the documentation to see how I needed to format the date inputs but there was no information about formatting dates or passing in a date-time object. All of the examples showed text inputs only.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SetValueForRangeDomain_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; fgdb&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'DateDomain'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'01/01/1980 12:00 AM'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'05/29/2018 12:00 AM'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When I checked the domain after running this, the time had automagically been set to 12:00am for both the minimum and maximum value. This made me assume that ArcGIS Pro had successfully converted my input strings for the min and max parameters to date-time objects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 3. Next, I assigned the domain to a field&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;table &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\\Users\johnmdye\Documents\ArcGIS\Projects\MyProject.gdb\TEST"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AssignDomainToField_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; table&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'DateField'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;'DateDomain'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; ‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After that successfully completed, I tried to edit the 'DateField' with the 'DateDomain' assigned to ensure that I could only specify a date between the min and max range, but I was able to enter any date I wanted and save the table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then tried performing the workflow completely through the Pro UI and discovered that after I'd created the 'DateDomain' domain manually, I couldn't assign it to my 'DateField' through the Pro UI. (The circles are my mouse clicks)&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="410136" alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/410136_ProUI.gif" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, in this case I jumped back to Step 2 above and executed the SetValueForRangeDomain_management tool to set 'DateDomain' on&amp;nbsp;'DateField' and it worked, or at least didn't return an error and when I looked at the Field Design for the TEST table, 'DateDomain' was indeed showing as being assigned to 'DateField'.&lt;IMG __jive_id="410137" alt="" class="image-2 jive-image j-img-original" src="/legacyfs/online/410137_Screen Shot 2018-05-29 at 7.39.20 PM.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, then I added 'TEST' table to a new map and attempted to edit the 'DateField' for a record. &lt;SPAN style="color: #ff0000;"&gt;Lo and behold, I could enter any date I wanted and save the table.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-align: center;"&gt;&lt;IMG __jive_id="410193" alt="" class="image-3 jive-image j-img-original" src="/legacyfs/online/410193_Screen Shot 2018-05-29 at 7.46.22 PM.png" /&gt;&lt;SPAN style="color: #808080; font-size: 11px;"&gt;I shouldn't be able to set the date to 5/30/2018 because the maximum value on&amp;nbsp;the DateDomain which is assigned to the DateField is '5/29/2018 12:00 AM'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What gives?! Am I doing something wrong? Can anyone else replicate this odd behavior?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:22:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/date-range-domains-what-gives/m-p/88376#M6873</guid>
      <dc:creator>JohnMDye</dc:creator>
      <dc:date>2021-12-10T23:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: Date-Range Domains - what gives</title>
      <link>https://community.esri.com/t5/python-questions/date-range-domains-what-gives/m-p/88377#M6874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have noticed a similar issue with 10.5 desktop.&amp;nbsp; I performed a test using a range domain on fields of type Long Integer and Date.&amp;nbsp; Editing a file geodatabase inside ArcMap, I could set the fields to a value outside the range.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2018 00:31:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/date-range-domains-what-gives/m-p/88377#M6874</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2018-05-31T00:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: Date-Range Domains - what gives</title>
      <link>https://community.esri.com/t5/python-questions/date-range-domains-what-gives/m-p/1045082#M60716</link>
      <description>&lt;P&gt;My experience is that the use of domains will not prohibit the entry of data that does not conform to the configured domains.&amp;nbsp; You can calculate the fields to whatever you want; or enter the nonconforming data manually.&amp;nbsp; I think domains are more for convenience and promoting consistency when users are editing data with less sophisticated tools, such as web maps and mobile apps.&amp;nbsp; They certainly do not enforce data consistency.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Apr 2021 15:11:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/date-range-domains-what-gives/m-p/1045082#M60716</guid>
      <dc:creator>blackcloud77</dc:creator>
      <dc:date>2021-04-08T15:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: Date-Range Domains - what gives</title>
      <link>https://community.esri.com/t5/python-questions/date-range-domains-what-gives/m-p/1602924#M73988</link>
      <description>&lt;P&gt;Writing a follow up here in case the information might help someone else who stumbles on this post like I did.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For doing this in code, here is an example of code that worked for me:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.management.SetValueForRangeDomain(
    in_workspace=r"PATH TO YOUR DATABASE",
    domain_name="DateRange",
    min_value="1/1/1900 12:00:00 AM",
    max_value="1/1/2100 12:00:00 AM"
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And if you want to do it in the GUI, if the Field Type is "Date" and the Domain Type is "Range Domain", then when you click within the Minimum or Maximum cells, there will be a GUI calendar input where you can select the date.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Katie_Clark_0-1743791279169.png" style="width: 748px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129529i45491223F383EB2B/image-dimensions/748x124?v=v2" width="748" height="124" role="button" title="Katie_Clark_0-1743791279169.png" alt="Katie_Clark_0-1743791279169.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Apr 2025 18:29:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/date-range-domains-what-gives/m-p/1602924#M73988</guid>
      <dc:creator>Katie_Clark</dc:creator>
      <dc:date>2025-04-04T18:29:05Z</dc:date>
    </item>
  </channel>
</rss>

