<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Issue with datetext function with different locale settings</title><link>https://community.appian.com/discussions/f/user-interface/23324/issue-with-datetext-function-with-different-locale-settings</link><description>Hi, 
 
 The datetext function returns incorrect date with different locale settings. Please refer below: 
 datetext(ri!dateInput, &amp;quot;dd MMM YYY&amp;quot;) 
 Input Date: 12/29/2021 - English/United states as locale -&amp;gt; 29 Dec 2022 
 Input Date: 29/12/2021 - English</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Issue with datetext function with different locale settings</title><link>https://community.appian.com/thread/89641?ContentTypeID=1</link><pubDate>Tue, 11 Jan 2022 14:28:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:47c56ae0-38a8-469d-8722-564bb868b978</guid><dc:creator>agam</dc:creator><description>&lt;p&gt;yea, nice to play with this&lt;/p&gt;
&lt;p&gt;I wrote this expression to analyse it from 1930 for the next 100 years&lt;/p&gt;
&lt;p&gt;The years where it outputs wrong repeats in an order of &lt;strong&gt;4,3,3,3&lt;/strong&gt;,&lt;strong&gt;3&lt;/strong&gt;,4,3,3,3,3,4,...&lt;/p&gt;
&lt;p&gt;and similarly where it comes correctly are:&amp;nbsp;&lt;strong&gt;3,2,2,3,2,&lt;/strong&gt;3,2,2,3,2,3,...&lt;/p&gt;
&lt;p&gt;I wonder something gets messy due to leap years or so.....&lt;/p&gt;
&lt;p&gt;Hope the screenshot highlight helps and hope Appian reads this post and can use it&amp;nbsp;&lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!startYear: 1930,
  a!forEach(
    items: enumerate(2030 - local!startYear),
    expression: a!localVariables(
      local!date: &amp;quot;12/29/&amp;quot; &amp;amp; local!startYear + fv!index - 1,
      local!datetext: datetext(todate(local!date), &amp;quot;dd MMM YYYY&amp;quot;),
      local!text: text(todate(local!date), &amp;quot;dd MMM YYYY&amp;quot;),
      local!equal: local!datetext = local!text,
      &amp;quot;Input Date: &amp;quot; &amp;amp; local!date &amp;amp; &amp;quot;  |  Date Text Function: &amp;quot; &amp;amp; local!datetext &amp;amp; &amp;quot;  |  Text Function: &amp;quot; &amp;amp; local!text &amp;amp; &amp;quot;  |  Match: &amp;quot; &amp;amp; local!equal
    )
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/13/pastedimage1641910989922v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/13/pastedimage1641911125149v2.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with datetext function with different locale settings</title><link>https://community.appian.com/thread/89614?ContentTypeID=1</link><pubDate>Tue, 11 Jan 2022 06:56:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bc1b558b-db2d-49e4-a8dc-e2e3913fc32c</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;Hi there,&lt;/p&gt;
&lt;p&gt;Try using text() function instead of dateText()&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with datetext function with different locale settings</title><link>https://community.appian.com/thread/89604?ContentTypeID=1</link><pubDate>Mon, 10 Jan 2022 19:22:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f68d65ba-411f-4dcf-8203-53070eb018ee</guid><dc:creator>Richard Michaelis</dc:creator><description>&lt;p&gt;I think datetext has a kind of bug. I played a bit with it.&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!date: todate(&amp;quot;12/29/2007&amp;quot;),
  a!formLayout(
    contents: {
      a!textfield(
        value: datetext(local!date, &amp;quot;dd MMM YYYY&amp;quot;),
        readOnly: true
      )
    }
  )
) -&amp;gt; until that date correct result

a!localVariables(
  local!date: todate(&amp;quot;12/29/2008&amp;quot;),
  a!formLayout(
    contents: {
      a!textfield(
        value: datetext(local!date, &amp;quot;dd MMM YYYY&amp;quot;),
        readOnly: true
      )
    }
  )
) -&amp;gt; 29 Dec 2009 until 2015-&amp;gt; 29 Dec 2016
a!localVariables(
  local!date: todate(&amp;quot;12/29/2016&amp;quot;),
  a!formLayout(
    contents: {
      a!textfield(
        value: datetext(local!date, &amp;quot;dd MMM YYYY&amp;quot;),
        readOnly: true
      )
    }
  )
) -&amp;gt; 29 Dec 2016  until 2018-&amp;gt; 29 Dec 2018

a!localVariables(
  local!date: todate(&amp;quot;12/29/2019&amp;quot;),
  a!formLayout(
    contents: {
      a!textfield(
        value: datetext(local!date, &amp;quot;dd MMM YYYY&amp;quot;),
        readOnly: true
      )
    }
  )
) -&amp;gt; 29 Dec 2020  and 2021 -&amp;gt; 29 Dec 2022
2022 is correct again. Not sure what the issue could be&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with datetext function with different locale settings</title><link>https://community.appian.com/thread/89601?ContentTypeID=1</link><pubDate>Mon, 10 Jan 2022 19:07:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0a554470-2ed3-4104-b561-7d1bc5839419</guid><dc:creator>agam</dc:creator><description>&lt;p&gt;weird !&amp;nbsp;&lt;/p&gt;
&lt;p&gt;here&amp;#39;s an alternative if you need it&lt;/p&gt;
&lt;p&gt;use:&amp;nbsp;text(ri!date, &amp;quot;dd MMM YYYY&amp;quot;)&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/13/pastedimage1641841641470v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with datetext function with different locale settings</title><link>https://community.appian.com/thread/89549?ContentTypeID=1</link><pubDate>Fri, 07 Jan 2022 21:05:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3dddd157-6aa7-4ec4-ba38-b3964af95533</guid><dc:creator>Harm Kolvoort</dc:creator><description>&lt;p&gt;I did see the same thing happening. Switched local couple of times, used date selector, userdatevalue() and date()&amp;nbsp;functions as input. After that issue didn&amp;#39;t occur anymore. Strange&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>