<?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: How to calculate text dates ? in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71888#M24493</link>
    <description>&lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/33399"&gt;@PatrykLiberski&lt;/a&gt; I would suggest doing it the way Michal explains.&lt;BR /&gt;&lt;BR /&gt;The other way I was just attempting is in C#. I'm only a novice at .NET so it's almost there.&lt;BR /&gt;&lt;BR /&gt;You'd could use a C# code stage, using the namespace import​ "System.Globalization".&lt;BR /&gt;&lt;BR /&gt;Input to the code stage: dateTimeIn&lt;BR /&gt;Output from the code stage: dateTimeOut&lt;BR /&gt;&lt;BR /&gt;C# Code:&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN style="background-color: #ffffff;"&gt;var textDateTime = String.Format("{0:dd/MM/yyyy HH:mm:ss}" , dateTimeIn);&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="background-color: #ffffff;"&gt;dateTimeOut = DateTime.Parse(textDateTime);&lt;BR /&gt;&lt;BR /&gt;This has the same purpose as Michael's solution but doing it a different way. Provide a text string or a DateTime to the input and it'll basically just switch the day and month if what you give it is a string or DateTime where the month and day are already switched to be wrong.&lt;BR /&gt;&lt;BR /&gt;The only issue I have with this is that it's converting to UTC. I'm assuming I'd just need to use SpecifyKind, but you could also just use the Date and Time Manipulation object convert from UTC to Local as well. Anyway, just wanted to provide this as an alternative but I see no reason not to use Michal's suggestion especially since it's more practice with logic in Blue Prism.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Dave Morris&lt;BR /&gt;3Ci @ Southern Company&lt;BR /&gt;Atlanta, GA&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
    <pubDate>Fri, 19 Jul 2019 12:30:00 GMT</pubDate>
    <dc:creator>david.l.morris</dc:creator>
    <dc:date>2019-07-19T12:30:00Z</dc:date>
    <item>
      <title>How to calculate text dates ?</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71882#M24487</link>
      <description>&lt;P&gt;Hello, is it possible to calculate text dates? Or to remove just the rest of my text?&lt;/P&gt;
&lt;P&gt;I need to calculate days of leave. I have two data items and I must substract one from another. For example&amp;nbsp;11/3/2017 12:00:00 AM - 3/31/2017 12:00:00 AM. How can I do this? So far I've tried Replace function. I wanted to use Mid, Trim and Left but the characters in my date items are going to change. so sometimes I will have 9 characters (11/3/2017) and sometimes 8 (1/3/2017).&lt;/P&gt;
&lt;P&gt;Which function could I use ?&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Patryk&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Jul 2019 10:53:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71882#M24487</guid>
      <dc:creator>PatrykLiberski</dc:creator>
      <dc:date>2019-07-19T10:53:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to calculate text dates ?</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71883#M24488</link>
      <description>In that particular example, you could use the Utility - Strings object's action 'Split Text' and use "-" as the Split Char. It'll give you a collection with two rows. The first row is your first date and your second row is your second date. You can just loop into the collection or whatever to get your values and use ToDateTime() on them or implicitly cast them into DateTime data items.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Dave Morris&lt;BR /&gt;3Ci @ Southern Company&lt;BR /&gt;Atlanta, GA&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Jul 2019 10:58:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71883#M24488</guid>
      <dc:creator>david.l.morris</dc:creator>
      <dc:date>2019-07-19T10:58:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to calculate text dates ?</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71884#M24489</link>
      <description>but this format is&lt;SPAN&gt;&amp;nbsp;month/day/year and mine is day/month/year&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Patryk Liberski&lt;BR /&gt;Consultant&lt;BR /&gt;Symphony Ventures&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Jul 2019 11:22:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71884#M24489</guid>
      <dc:creator>PatrykLiberski</dc:creator>
      <dc:date>2019-07-19T11:22:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to calculate text dates ?</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71885#M24490</link>
      <description>Hi Patryk,&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can convert these data items (ToDate function should work) to date even with time included. Then use function DateDiff to calculate final difference.&lt;BR /&gt;&lt;BR /&gt;Best reards,&lt;BR /&gt;Michal&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Michal Szumski&lt;BR /&gt;RPA developer&lt;BR /&gt;Rockwell Automation&lt;BR /&gt;Europe/Warsaw&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Jul 2019 11:28:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71885#M24490</guid>
      <dc:creator>MichalSzumski</dc:creator>
      <dc:date>2019-07-19T11:28:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to calculate text dates ?</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71886#M24491</link>
      <description>I've tried but it failed because of different date formats&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Patryk Liberski&lt;BR /&gt;Consultant&lt;BR /&gt;Symphony Ventures&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Jul 2019 11:43:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71886#M24491</guid>
      <dc:creator>PatrykLiberski</dc:creator>
      <dc:date>2019-07-19T11:43:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to calculate text dates ?</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71887#M24492</link>
      <description>HI Patryk,&lt;BR /&gt;&lt;BR /&gt;So let me understand it - You have two text data items with dates but in different format that Your system has - right? and You want to calculate differences between them?&lt;BR /&gt;&lt;BR /&gt;If my understanding is correct then it may be a bit more difficult without specific code stage. What I would do in Your place is:&lt;BR /&gt;&lt;BR /&gt;1. Use below expression to split out date from time for both data items (put data items instead of hardcoded values):&lt;BR /&gt;Left("11/3/2017 12:00:00 AM", InStr("11/3/2017 12:00:00 AM", " ")) &lt;BR /&gt;2. Use &lt;SPAN&gt;Utility - Strings object's action 'Split Text'&lt;/SPAN&gt; mentioned before on both data items - using "/" as delimiter&lt;BR /&gt;3. Now You know in which row You have days, months and years - You can use "Read Collection Field" from "Utility - Collection Manipulation" to get specific rows to variables to obtain Year, Month and Day. Next You can rearrange Your date in simple calculation.&lt;BR /&gt;4. After that You should have two data items with text dates but in correct format - now You can use ToDate and then DateDiff&lt;BR /&gt;&lt;BR /&gt;It is probably over-complicated but this would be my first idea without a code stage for that specific problem - it should work to pass this problem for now.&lt;BR /&gt;&lt;BR /&gt;Best regards&lt;BR /&gt;Michal&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Michal Szumski&lt;BR /&gt;RPA developer&lt;BR /&gt;Rockwell Automation&lt;BR /&gt;Europe/Warsaw&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Jul 2019 12:13:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71887#M24492</guid>
      <dc:creator>MichalSzumski</dc:creator>
      <dc:date>2019-07-19T12:13:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to calculate text dates ?</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71888#M24493</link>
      <description>&lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/33399"&gt;@PatrykLiberski&lt;/a&gt; I would suggest doing it the way Michal explains.&lt;BR /&gt;&lt;BR /&gt;The other way I was just attempting is in C#. I'm only a novice at .NET so it's almost there.&lt;BR /&gt;&lt;BR /&gt;You'd could use a C# code stage, using the namespace import​ "System.Globalization".&lt;BR /&gt;&lt;BR /&gt;Input to the code stage: dateTimeIn&lt;BR /&gt;Output from the code stage: dateTimeOut&lt;BR /&gt;&lt;BR /&gt;C# Code:&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN style="background-color: #ffffff;"&gt;var textDateTime = String.Format("{0:dd/MM/yyyy HH:mm:ss}" , dateTimeIn);&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="background-color: #ffffff;"&gt;dateTimeOut = DateTime.Parse(textDateTime);&lt;BR /&gt;&lt;BR /&gt;This has the same purpose as Michael's solution but doing it a different way. Provide a text string or a DateTime to the input and it'll basically just switch the day and month if what you give it is a string or DateTime where the month and day are already switched to be wrong.&lt;BR /&gt;&lt;BR /&gt;The only issue I have with this is that it's converting to UTC. I'm assuming I'd just need to use SpecifyKind, but you could also just use the Date and Time Manipulation object convert from UTC to Local as well. Anyway, just wanted to provide this as an alternative but I see no reason not to use Michal's suggestion especially since it's more practice with logic in Blue Prism.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Dave Morris&lt;BR /&gt;3Ci @ Southern Company&lt;BR /&gt;Atlanta, GA&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Jul 2019 12:30:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71888#M24493</guid>
      <dc:creator>david.l.morris</dc:creator>
      <dc:date>2019-07-19T12:30:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to calculate text dates ?</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71889#M24494</link>
      <description>&lt;A class="user-content-mention" data-sign="@" data-contactkey="f132f667-3fea-4f20-9d25-61bf263bad4e" data-tag-text="@Michal Szumski" href="https://community.blueprism.com/network/profile?UserKey=f132f667-3fea-4f20-9d25-61bf263bad4e" data-itemmentionkey="343f5c81-2db3-4621-bf4a-38e6f005ee3b"&gt;@Michal Szumski&lt;/A&gt;l thanks, but I cannot read the rest of my date items. I am able to only read the first value so in this case number 11. I cannot read the day nor the month. I have only 1 column in my collection and this&amp;nbsp;&lt;SPAN&gt;"Read Collection Field" from "Utility - Collection Manipulation" reads only the first value. Please have a look on my screenshot&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Patryk Liberski&lt;BR /&gt;Consultant&lt;BR /&gt;Symphony Ventures&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Jul 2019 13:01:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71889#M24494</guid>
      <dc:creator>PatrykLiberski</dc:creator>
      <dc:date>2019-07-19T13:01:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to calculate text dates ?</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71890#M24495</link>
      <description>Hi Patryk,&lt;BR /&gt;&lt;BR /&gt;You have to define row index and field name to get specific collection "cell":&lt;BR /&gt;
&lt;DIV class="media" style="overflow: hidden; zoom: 1;"&gt;
&lt;DIV class="media" style="overflow: hidden; zoom: 1;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="15138.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/15301i2972259654592A6F/image-size/large?v=v2&amp;amp;px=999" role="button" title="15138.png" alt="15138.png" /&gt;&lt;/span&gt;&lt;BR /&gt;0 - means first row, 1 means second row and so on. In Field Name just put name of the column that was created by "Split" action. For me it worked just fine but You need to use this action 3 times for each part of date.&lt;BR /&gt;&lt;BR /&gt;If You really want to avoid using this action from collection manipulation then You could just loop through this collection and count rows. In the same loop You can make choice stage that for row number 1 You will take value as month, for row number 2 You will take day and finally You have year.&lt;BR /&gt;&lt;BR /&gt;It is lot of unnecessary steps but it still should work and You will avoid using action&amp;nbsp;&lt;SPAN&gt;"Read Collection Field" from "Utility - Collection Manipulation".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;Best regards&lt;BR /&gt;Michal&lt;/DIV&gt;
&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Michal Szumski&lt;BR /&gt;RPA developer&lt;BR /&gt;Rockwell Automation&lt;BR /&gt;Europe/Warsaw&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Jul 2019 13:19:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71890#M24495</guid>
      <dc:creator>MichalSzumski</dc:creator>
      <dc:date>2019-07-19T13:19:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to calculate text dates ?</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71891#M24496</link>
      <description>It works now. I've changed the Row Index value. My code is huge now. I will try to modify and improve it. Thank you so much for your help.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Patryk Liberski&lt;BR /&gt;Consultant&lt;BR /&gt;Symphony Ventures&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Jul 2019 13:19:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71891#M24496</guid>
      <dc:creator>PatrykLiberski</dc:creator>
      <dc:date>2019-07-19T13:19:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to calculate text dates ?</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71892#M24497</link>
      <description>Yes - it is over-complicated as I said. I would treat this solution as temporary and for example create later code stage like David suggested to make it more elegant and effective.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;/STRONG&gt;Best regards,&lt;BR /&gt;Michal&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Michal Szumski&lt;BR /&gt;RPA developer&lt;BR /&gt;Rockwell Automation&lt;BR /&gt;Europe/Warsaw&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Jul 2019 13:26:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-calculate-text-dates/m-p/71892#M24497</guid>
      <dc:creator>MichalSzumski</dc:creator>
      <dc:date>2019-07-19T13:26:00Z</dc:date>
    </item>
  </channel>
</rss>

