I want to convert this string “04/04/2022 2:35 PM” to dateTime variable.
dateString = “04/04/2022 2:35 PM”
arr_strFormats = {“M/d/yyyy h:mm tt”,“MM.dd.yyyy h:mm tt”}
I tried to do this but it dint work: DateTime.ParseExact(dateString,arr_strFormats,System.Globalization.CultureInfo.InvariantCulture,DateTimeStyles.None)
Error: Assign: String was not recognized as a valid DateTime.
It seems that there is something wrong with the Input Data. It is not in the right format. It appears as Simple String, but it is not. It is as you have said very Strange.
Could you type the Input data in your expression and Check. Do not Copy Paste .
Are you using a Copy to Clipboard activity and storing it in the dateString variable ?
Yes as @supermanPunch suggested, if you would have copy pasted the string from some source, there is a chance of invalid format which may not be visible.