cancel
Showing results for 
Search instead for 
Did you mean: 

How to write 20220915 as 2022/09/15

HelariaShaningw
Level 3
Good day

Can you please help me out as i am new to blue prism.
How can i write this data item value "20201015" as 2020/10/15?. This value i am getting it from a business object as it is by using a read stage. I tried using split text and extract regex values but no difference.

This value "20221015" is read and stored in the data Item as Text.
FomatDate did also not work.

------------------------------
Helaria Shaningwa
RPA Intern
------------------------------
5 REPLIES 5

ShuaibSalie
Level 3
Hi Helaria,

Here's a way of achieving what you want, hopefully it can help you. 
So first we need a way to extract the day, month and year from your text data item:

Right([Data1], 2) - We are extracting the day here
Left([Data1], 4) - We are extracting the year
Mid([Data1], 5, 2) - We are extracting the month

Then we need to make it a date:

MakeDate(Right([Data1], 2), Mid([Data1], 5, 2), Left([Data1], 4))

Then lastly we put it all together and format the date (The below expression is what you'll use in your calc stage):

FormatDate(MakeDate(Right([Data1], 2), Mid([Data1], 5, 2), Left([Data1], 4)), "yyyy/MM/dd")

There might be simpler ways of achieving this.

I hope it helps you
Thank you

------------------------------
Shuaib Salie

------------------------------

Hi @Helaria Shaningwa,

You can

13048.png
For finding year:

13049.png
For finding Date:

13050.png
For finding month, since we know that it will always be after 4th character and its format is MM (2 characters) hence:

13051.png

For performing final calculation:

13052.png
Please let me know if it doesn't work for you.

------------------------------
Manpreet Kaur
Manager
Deloitte
------------------------------

Hi Manpreet Kaur

It is working perfectly.
Thank you very much.

------------------------------
Helaria Shaningwa
------------------------------

Hi Shuaib Salie

Issue is resolved, thanks very much for your input.
Much appreciated.

------------------------------
Helaria Shaningwa
------------------------------

Hi @Helaria Shaningwa,

Glad to hear it worked :)​​

------------------------------
Manpreet Kaur
Manager
Deloitte
------------------------------