<?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: Split french date issue in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/split-french-date-issue/m-p/1225081#M6383</link>
    <description>&lt;P&gt;could it be that Date expects year, month, day?&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/arcade/function-reference/date_functions/#date" target="_blank"&gt;Date Functions | ArcGIS Arcade | ArcGIS Developers&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Oct 2022 08:52:03 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2022-10-25T08:52:03Z</dc:date>
    <item>
      <title>Split french date issue</title>
      <link>https://community.esri.com/t5/developers-questions/split-french-date-issue/m-p/1225076#M6382</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In ArcGis Pro 2.9.5 with Calculate Fied, i split a french date text and i want insert in Date Field.&lt;/P&gt;&lt;P&gt;First task, split the text with / to extract the 3 parts of the text&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var date_array = Split("01/01/1987","/",-1);
return IndexOf(date_array,0)  + "/" + IndexOf(date_array,1)  + "/" + IndexOf(date_array,2) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Returned "-1/-1/-1"&lt;/P&gt;&lt;P&gt;i don't see my mistake&lt;/P&gt;&lt;P&gt;Thanks forn your help&lt;/P&gt;&lt;P&gt;Rémy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 08:33:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/split-french-date-issue/m-p/1225076#M6382</guid>
      <dc:creator>Rémy_Gourrat</dc:creator>
      <dc:date>2022-10-25T08:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: Split french date issue</title>
      <link>https://community.esri.com/t5/developers-questions/split-french-date-issue/m-p/1225081#M6383</link>
      <description>&lt;P&gt;could it be that Date expects year, month, day?&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/arcade/function-reference/date_functions/#date" target="_blank"&gt;Date Functions | ArcGIS Arcade | ArcGIS Developers&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 08:52:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/split-french-date-issue/m-p/1225081#M6383</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-10-25T08:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: Split french date issue</title>
      <link>https://community.esri.com/t5/developers-questions/split-french-date-issue/m-p/1225086#M6384</link>
      <description>&lt;LI-CODE lang="javascript"&gt;var date_array = Split("01/01/1987","/",-1);

// Date(year, month day)
// month is zero indexed -&amp;gt; January is 0
return Date(date_array[2], date_array[1] - 1, date_array[0])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1666688707745.png" style="width: 442px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/54337iA374B8B0B4108017/image-dimensions/442x293?v=v2" width="442" height="293" role="button" title="JohannesLindner_0-1666688707745.png" alt="JohannesLindner_0-1666688707745.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 09:05:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/split-french-date-issue/m-p/1225086#M6384</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-10-25T09:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: Split french date issue</title>
      <link>https://community.esri.com/t5/developers-questions/split-french-date-issue/m-p/1225089#M6385</link>
      <description>&lt;P&gt;Here's your error:&lt;/P&gt;&lt;P&gt;IndexOf searches for an element in an array and returns its index. It returns -1 if the element is not in the list. So you searched for 0, 1, and 2 in ["1", "1", "1987"]. These elements are not in the array, so IndexOf returns -1.&lt;/P&gt;&lt;P&gt;To get a certain element of an array by index, use bracket notation:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var test_array = [1, 2, 3]
Console(test_array[0]) // 1
Console(test_array[1]) // 2
Console(test_array[2]) // 3
Console(test_array[-1]) // 3
Console(test_array[-2]) // 2
Console(test_array[-3]) // 1
Console(test_array[3]) // index error
Console(test_array[-4]) // index error&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 25 Oct 2022 09:10:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/split-french-date-issue/m-p/1225089#M6385</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-10-25T09:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: Split french date issue</title>
      <link>https://community.esri.com/t5/developers-questions/split-french-date-issue/m-p/1225100#M6386</link>
      <description>&lt;P&gt;Thanks for your answereds,&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;&amp;nbsp;and &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;, i'm agree with you but my issue was before like &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;has detected.&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;i recognize the webmap expression editor, but my issue was under &lt;STRONG&gt;ArcGIS Pro 2.9.5.&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I retype the code and it's better but not perfect...&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;first point :&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Date substract 1 hour to my date, i tried with ToLocal or with setting hours and minutes to 0, but it's same thing. I can add 1 hour but i would like understand...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Rmy_Gourrat_2-1666694355492.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/54342i903584E03895A514/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rmy_Gourrat_2-1666694355492.png" alt="Rmy_Gourrat_2-1666694355492.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;second point :&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;In ArcGIS Pro 2.9.5&lt;/STRONG&gt;, when you valid my arcade expression i have an error message but when i apply it it's running well ! may be a bug ?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Rmy_Gourrat_3-1666694600249.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/54343i88AD62342F9D8EC9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rmy_Gourrat_3-1666694600249.png" alt="Rmy_Gourrat_3-1666694600249.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Rémy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 10:44:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/split-french-date-issue/m-p/1225100#M6386</guid>
      <dc:creator>Rémy_Gourrat</dc:creator>
      <dc:date>2022-10-25T10:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: Split french date issue</title>
      <link>https://community.esri.com/t5/developers-questions/split-french-date-issue/m-p/1225123#M6387</link>
      <description>&lt;P&gt;&lt;U&gt;First Point&lt;/U&gt;&lt;/P&gt;&lt;P&gt;I didn't think about timezones when I tested... The feature class stores date values in UTC. According to the documentation, the value returned by Date() is considered to be UTC, but the behavior you (and me, too) see suggests that it treats it as local time. You're in CET (UTC+1), so it subtracts the hour. In the summer months, you're in CEST (UTC+2), you should see values with a time of 22:00:00.&lt;/P&gt;&lt;P&gt;I haven't found a way to change that behavior. ToUTC() and ToLocal() don't have any effect. Setting the hour to 1 (or adding an hour) works, but that still leaves the problem with summer time.&lt;/P&gt;&lt;P&gt;I think in this case it's best to do it with Python. In the Field Calculation, switch to Python and use this expression:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;datetime.datetime.strptime(!zz_ff_jdatat!, "%d/%m/%Y")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Second Point&lt;/U&gt;&lt;/P&gt;&lt;P&gt;This seems to be a bug. For validation, ArcGIS runs the expression on a row of your table. It apparently doesn't honor definition queries of the layer. You probably have a definition query set to "TextField IS NOT NULL" or something similar. When the tool runs, it doesn't encounter an error, but for validation, it grabs a feature that should be excluded from the layer.&lt;/P&gt;&lt;P&gt;I just posted an idea about this, please lend your support to it, so that this will hopefully be fixed in the future:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/honor-definition-query-in-arcade-validation/idi-p/1225110/jump-to/first-unread-message" target="_blank" rel="noopener"&gt;Honor Definition Query in Arcade Validation - Esri Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 12:04:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/split-french-date-issue/m-p/1225123#M6387</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-10-25T12:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: Split french date issue</title>
      <link>https://community.esri.com/t5/developers-questions/split-french-date-issue/m-p/1225133#M6388</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally for the second point, ArcGIS Pro don't validate my expression but execute it, i just change my code like this to be more robust...&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var date_array;
if ($feature.zz_ff_jdatat != Null) {
   date_array = Split($feature.zz_ff_jdatat,"/",-1);
   return Date(date_array[2],date_array[1]-1,date_array[0],0,0);
}
else {
   return Null;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 12:32:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/split-french-date-issue/m-p/1225133#M6388</guid>
      <dc:creator>Rémy_Gourrat</dc:creator>
      <dc:date>2022-10-25T12:32:26Z</dc:date>
    </item>
  </channel>
</rss>

