agoyal1980
(Ashish Goyal)
January 15, 2020, 11:06pm
1
Hi All
I am working on a BOT which involves extracting the individual date fields from a string
i.e extract start month, start date , start year, end month, end date and end year into individual variables from string Jan 5, 2020 - Jan 11, 2020 another example Dec 29, 2019 - Jan 4, 2020
Any thoughts on how to get this done in UI PATH?
Thanks
1 Like
agoyal1980
(Ashish Goyal)
January 15, 2020, 11:26pm
2
Just to add…The eventual goal is to convert the string Jan 5, 2020 - Jan 11, 2020 to two string variables 1/5/2020 and 1/11/2020
Yoichi
(Yoichi)
January 15, 2020, 11:35pm
3
Hi,
Can you try the following expression? (Let’s say strData = “Jan 5, 2020 - Jan 11, 2020” etc.)
strStart = DateTime.ParseExact(strData.Split("-"c)(0).Trim,"MMM d, yyyy",nothing).ToString("M/d/yyyy")
strEnd = DateTime.ParseExact(strData.Split("-"c)(1).Trim,"MMM d, yyyy",nothing).ToString("M/d/yyyy")
Regards,
2 Likes
agoyal1980
(Ashish Goyal)
January 16, 2020, 2:23am
4
Yoichi:
strStart = DateTime.ParseExact(strData.Split("-“c)(0).Trim,“MMM d, yyyy”,nothing).ToString(“M/d/yyyy”) strEnd = DateTime.ParseExact(strData.Split(”-"c)(1).Trim,“MMM d, yyyy”,nothing).ToString(“M/d/yyyy”)
Worked like a Charm. Thanks for your prompt help!
1 Like
system
(system)
Closed
January 19, 2020, 2:24am
5
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.