String Value to Timespan

Hi guys,

I want to convert String value to Timespan,.
I have 2 condition, which is 1 Hr, 21 Minutes or 21 Minutes
Do i need to convert the string first?
for example : 1 Hr, 21 Minutes --> 1 Hour 21 Minutes
or can convert directly to timespan.

Regards,.

Hi,

Can you try the below function
TimeSpan.Parse(“01:21:00”)
capture only digits from your string and make the above format then try.

I hope it will help.
Mark as solution if it works