Convert to DateTime that are in different formats

I have a input string, which I want to convert to datetime. Normally I could use Assign = Date.ParseExact(inputstring,“dd.MM.yyyy”,System.Globalization.CultureInfo.InvariantCulture).
Question is, I need the end format to be dd/MM/yyyy but the input String can be in a different format. For example “12/03/2020” or “03/12/2020” or “03/12/2020 HH:mm:ss ” or even “March 12, 2020” etc.
any ideas?

Hi @Juhi_Patil

Please have a look at this thread,

All dates format in a given string - Help / Studio - UiPath Community Forum

Hope that helps,

Thanks

have a look here:

especially check out: Section Fixing Strategy

arrFormats | String() = {"dd/MM/yyyy","MMMM dd, yyyy"} etc.
DateTime.ParseExact(YourDateTimeString, arrFormats, cultureinfo, DateTimeStyles.None)

I get an error for {“dd/MM/yyyy”,“MMMM dd, yyyy”} saying 'Not all code paths return a value in lambda expression of type Func
arrFormat is of string type
I am working in C#

Datetime values don’t have formats. You format them when you output them to string. The format you pass to Parse is to tell it how to identify month, day, year etc in the input string.