<?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>Update a given date on some conditions</title><link>https://community.appian.com/discussions/f/rules/28109/update-a-given-date-on-some-conditions</link><description>Hi, 
 I have a requirement to update a date based on a condition that if the given date is of last 2 dates of that particular month, then I want my rule to return first date of the next month and it should be applicable for all the dates whether the month</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Update a given date on some conditions</title><link>https://community.appian.com/thread/111333?ContentTypeID=1</link><pubDate>Wed, 19 Apr 2023 10:52:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dbafdcfc-98f5-4bc6-9f4b-98752046b53a</guid><dc:creator>sanchitg0002</dc:creator><description>&lt;p&gt;Welcome, glad to hear that &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;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update a given date on some conditions</title><link>https://community.appian.com/thread/111328?ContentTypeID=1</link><pubDate>Wed, 19 Apr 2023 10:03:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:19a02ccd-9950-4e86-a8be-84a240e0ab56</guid><dc:creator>AlexanderPatterson</dc:creator><description>&lt;p&gt;Thank you for helping me as well &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;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update a given date on some conditions</title><link>https://community.appian.com/thread/111327?ContentTypeID=1</link><pubDate>Wed, 19 Apr 2023 09:59:12 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:63e590be-b0fb-4d11-b7b5-e4b5133bbbbd</guid><dc:creator>raymondm2600</dc:creator><description>&lt;p&gt;Thank you so much for the response.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update a given date on some conditions</title><link>https://community.appian.com/thread/109584?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2023 19:07:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e468d616-9e88-4047-a921-19c78de2720f</guid><dc:creator>rahuls7726</dc:creator><description>&lt;p&gt;Thank you so much for the response, this is exactly what I needed I&amp;#39;m amazed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update a given date on some conditions</title><link>https://community.appian.com/thread/109582?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2023 18:30:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2b815d7b-ff25-467b-b4d6-67a6a5c34287</guid><dc:creator>sanchitg0002</dc:creator><description>&lt;p&gt;Frankly speaking I didn&amp;#39;t had enough patience and dare to look into what you have written in your code but AFAIU with the description, you can make it work like this by using some OOTB Appian functions and a simple logic.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!currentMonth: month(ri!requestDate),
  local!currentDay: day(ri!requestDate),
  local!currentYear: year(ri!requestDate),
  local!daysDifference: daysinmonth(local!currentMonth, local!currentYear) - local!currentDay,
  todate(
    adddays(
      todatetime(ri!requestDate),
      a!match(
        value: local!daysDifference,
        equals: 0,
        then: 1,
        equals: 1,
        then: 2,
        default: 0
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update a given date on some conditions</title><link>https://community.appian.com/thread/109581?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2023 18:25:50 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6aade5c6-9a00-4d38-a479-228d0a2597ec</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;For the longest time I didn&amp;#39;t know about the function &amp;quot;&lt;a href="https://docs.appian.com/suite/help/23.1/fnc_date_and_time_eomonth.html"&gt;eomonth()&lt;/a&gt;&amp;quot; and it probably caused me a lot of heartburn - i figure it might help you out here.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m a little unclear what&amp;#39;s being requested when ri!requestDate &lt;em&gt;&lt;strong&gt;isn&amp;#39;t&lt;/strong&gt;&lt;/em&gt; one of the last 2 days of the given month, but this seems to work for what I understand of your requirement:&lt;br /&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  
  local!eomonthDate: eomonth(ri!requestDate, 0),
  local!nextMonthStartDate: local!eomonthDate + 1,
  
  local!isApplicableDate: or(
    local!eomonthDate = {ri!requestDate, ri!requestDate + 1}
  ),
  
  if(
    local!isApplicableDate,
    local!nextMonthStartDate,
    ri!requestDate
  )
)&lt;/pre&gt;&lt;br /&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/15/pastedimage1678991735309v2.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update a given date on some conditions</title><link>https://community.appian.com/thread/109580?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2023 18:19:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e3ef4990-61b6-4bf5-8f05-8ddafe6e62be</guid><dc:creator>rahuls7726</dc:creator><description>&lt;p&gt;Sorry for that I have edited it&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update a given date on some conditions</title><link>https://community.appian.com/thread/109579?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2023 18:16:42 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:986b8d15-84f9-4fc0-ac9a-b3ca1967f831</guid><dc:creator>sanchitg0002</dc:creator><description>&lt;p&gt;First of all, edit this question and re paste your code in a code box.&lt;/p&gt;
&lt;p&gt;&lt;img height="126" src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/15/pastedimage1678990650803v1.png" width="210" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>