<?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 Wow.. that was brilliant... in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/Select-Previous-month-within-datetimes/m-p/55937#M10204</link>
    <description>Wow.. that was brilliant...
Thanks Christer.</description>
    <pubDate>Fri, 09 Jun 2017 22:20:00 GMT</pubDate>
    <dc:creator>hari.murali</dc:creator>
    <dc:date>2017-06-09T22:20:00Z</dc:date>
    <item>
      <title>Select Previous month within datetimes</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Select-Previous-month-within-datetimes/m-p/55932#M10199</link>
      <description>Hello!

I was wondering if anyone has a good idea on how I should perform following business logic: 

Create 2 DateTime strings , one is 16th of previous month and the other is the end of the previous month (28th or 30th or 31th day); I don't know however how I can state that the datetime should point its day to the last day of that month, is there any function for this?
The current DateTime string I have is:
"16-"&amp;amp;FormatDate(AddMonths(Today(); -1); "MM")&amp;amp;"-"&amp;amp;FormatDate(Today(); "yyyy")

I however want to know how I can make the end of the month dynamic, aka. I don't want to hardcode the 31 in following expression:
"31-"&amp;amp;FormatDate(AddMonths(Today(); -1); "MM")&amp;amp;"-"&amp;amp;FormatDate(Today(); "yyyy")

Thanks!
SÃ©ba</description>
      <pubDate>Thu, 08 Jun 2017 13:35:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Select-Previous-month-within-datetimes/m-p/55932#M10199</guid>
      <dc:creator>SébastienBulté</dc:creator>
      <dc:date>2017-06-08T13:35:00Z</dc:date>
    </item>
    <item>
      <title>Thanks for the hint. Solution</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Select-Previous-month-within-datetimes/m-p/55933#M10200</link>
      <description>Thanks for the hint. Solution for reference:
FormatDate(AddDays(MakeDate(1; FormatDate(Today(),""MM""); FormatDate(Today(),""yyyy"")),-1),""dd"")&amp;amp;""-""&amp;amp;FormatDate(AddMonths(Today(); -1); ""MM"")&amp;amp;""-""&amp;amp;FormatDate(Today(); ""yyyy"")
There should be better date manipulation tools by BP than this no?</description>
      <pubDate>Thu, 08 Jun 2017 15:52:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Select-Previous-month-within-datetimes/m-p/55933#M10200</guid>
      <dc:creator>SébastienBulté</dc:creator>
      <dc:date>2017-06-08T15:52:00Z</dc:date>
    </item>
    <item>
      <title>One other minor comment /</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Select-Previous-month-within-datetimes/m-p/55934#M10201</link>
      <description>One other minor comment / consideration is finding the last day. There should be a choice stage to identify the end day (28 or 29 or 30 or 31).
For 31:
Expression:
ToNumber(FormatDate(AddMonths(Today(), -1), ""MM"")) = 1 OR
ToNumber(FormatDate(AddMonths(Today(), -1), ""MM"")) = 3 OR
ToNumber(FormatDate(AddMonths(Today(), -1), ""MM"")) = 5 OR
ToNumber(FormatDate(AddMonths(Today(), -1), ""MM"")) = 7 OR
ToNumber(FormatDate(AddMonths(Today(), -1), ""MM"")) = 8 OR
ToNumber(FormatDate(AddMonths(Today(), -1), ""MM"")) = 10 OR
ToNumber(FormatDate(AddMonths(Today(), -1), ""MM"")) = 12
True:
MakeDate(31, ToNumber(FormatDate(AddMonths(Today(), -1), ""MM"")), FormatDate(Today(), ""yyyy"")
For 30:
Expression:
ToNumber(FormatDate(AddMonths(Today(), -1), ""MM"")) = 4 OR
ToNumber(FormatDate(AddMonths(Today(), -1), ""MM"")) = 6 OR
ToNumber(FormatDate(AddMonths(Today(), -1), ""MM"")) = 9 OR
ToNumber(FormatDate(AddMonths(Today(), -1), ""MM"")) = 11
True:
MakeDate(30, ToNumber(FormatDate(AddMonths(Today(), -1), ""MM"")), FormatDate(Today(), ""yyyy"")
For 28:
Expression:
ToNumber(FormatDate(AddMonths(Today(), -1), ""MM"")) = 2 AND InStr(ToNumber(FormatDate(Today(), ""yyyy"")) / 4, ""."")0
True:
MakeDate(28, ToNumber(FormatDate(AddMonths(Today(), -1), ""MM"")), FormatDate(Today(), ""yyyy"")
For 29:
Expression:
ToNumber(FormatDate(AddMonths(Today(), -1), ""MM"")) = 2 AND InStr(ToNumber(FormatDate(Today(), ""yyyy"")) / 4, ""."")=0
True:
MakeDate(29, ToNumber(FormatDate(AddMonths(Today(), -1), ""MM"")), FormatDate(Today(), ""yyyy"")
I have built an utility (Make Date) to perform these type of actions.</description>
      <pubDate>Thu, 08 Jun 2017 20:04:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Select-Previous-month-within-datetimes/m-p/55934#M10201</guid>
      <dc:creator>hari.murali</dc:creator>
      <dc:date>2017-06-08T20:04:00Z</dc:date>
    </item>
    <item>
      <title>You can easily use AddDays</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Select-Previous-month-within-datetimes/m-p/55935#M10202</link>
      <description>You can easily use AddDays(FormatDate(Today(); ""01.MM.yyyy""); -1)
First we formate the date to 01.MM.yyyy
then we add -1 day back.
Today() = 09.06.2017
Result: 31.05.2017</description>
      <pubDate>Fri, 09 Jun 2017 16:16:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Select-Previous-month-within-datetimes/m-p/55935#M10202</guid>
      <dc:creator>Christer_Tellefsen</dc:creator>
      <dc:date>2017-06-09T16:16:00Z</dc:date>
    </item>
    <item>
      <title>Or</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Select-Previous-month-within-datetimes/m-p/55936#M10203</link>
      <description>Or
AddDays(AddMonths(FormatDate(Today(); ""01.MM.yyyy""); [Months]); -1)
To get more end of the month &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Fri, 09 Jun 2017 16:32:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Select-Previous-month-within-datetimes/m-p/55936#M10203</guid>
      <dc:creator>Christer_Tellefsen</dc:creator>
      <dc:date>2017-06-09T16:32:00Z</dc:date>
    </item>
    <item>
      <title>Wow.. that was brilliant...</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Select-Previous-month-within-datetimes/m-p/55937#M10204</link>
      <description>Wow.. that was brilliant...
Thanks Christer.</description>
      <pubDate>Fri, 09 Jun 2017 22:20:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Select-Previous-month-within-datetimes/m-p/55937#M10204</guid>
      <dc:creator>hari.murali</dc:creator>
      <dc:date>2017-06-09T22:20:00Z</dc:date>
    </item>
    <item>
      <title>Ah I wasn't aware we could</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Select-Previous-month-within-datetimes/m-p/55938#M10205</link>
      <description>Ah I wasn't aware we could hardcode date values into the format string, thanks. This at least simplifies things a bit.</description>
      <pubDate>Mon, 12 Jun 2017 02:16:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Select-Previous-month-within-datetimes/m-p/55938#M10205</guid>
      <dc:creator>SébastienBulté</dc:creator>
      <dc:date>2017-06-12T02:16:00Z</dc:date>
    </item>
  </channel>
</rss>

