Extract individual date fields from a string

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?


1 Like

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


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")



Worked like a Charm. Thanks for your prompt help!

1 Like

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