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
AA
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
AA
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
Happy Automation
Best Regards
Er Pratik Wavhal
Hi
Let me give two expression in this case reason being 10 can be month 06 can be a date possibly
Or
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
Datetime.ParseExact(invariable.ToString,”yyyyMMdd”,System.Globalization.CultureInfo.InvariantCulture).ToString(“yyyy.MM.dd”)
For second case same but with different format
Datetime.ParseExact(invariable.ToString,”yyyyddMM”,System.Globalization.CultureInfo.InvariantCulture).ToString(“yyyy.MM.dd”)
Hope this would help you resolve this
Cheers @aapostol
Hi @aapostol
Try this expression
DateTime.ParseExact(“20211006”, “yyyyMMdd”, System.Globalization.CultureInfo.InvariantCulture).ToString(“yyyy.MM.dd”)
Regards
Sudharsan
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.