Formating string

Hi UiPath,

How can we transform a string to a specific format?

let say I do have the following string “20211006”

and I want it to be “2021.10.06” ?

Can someone help me?

thanks in advance


1 Like


Check below for your reference


Hope this may help you


1 Like

Hello @aapostol

May I know that is the string data is date or just a random string?

If yes then below expression might work for you:-

DateTime.ParseExact(“20211006”, “yyyyMMdd”, System.Globalization.CultureInfo.InvariantCulture).ToString(“yyyy.MM.dd”)

Mark as a solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:


Let me give two expression in this case reason being 10 can be month 06 can be a date possibly
10 can be date and 06 can be month at times

If you know the format exactly then use the corresponding one

For first case


For second case same but with different format


Hope this would help you resolve this

Cheers @aapostol

1 Like

Hi @aapostol
Try this expression

DateTime.ParseExact(“20211006”, “yyyyMMdd”, System.Globalization.CultureInfo.InvariantCulture).ToString(“yyyy.MM.dd”)


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.