datetimeparsingtype-conversioncultureinfouipath

UiPath error, DateTime.ParseExact not working


Screenshot showing the "error"

I have this: DateTime.ParseExact(CurrentRow.Item("Date").ToString.Trim(),“dd.MM.yyyy”,System.Globalization.CultureInfo.InvariantCulture) But it doesn't work. It runs the project and the only error that appears to exist is the spiky red line under yyyy. What am I doing wrong? I have also trid CurrentRow.ItemArray(respectiveNumber). Am assigning this to a DateTime in UiPath Studio, which is inside a foreach of a DataTable (CurrentRow is the item) and I have pretty much tried every single solution you could possibly find online (that I know).

Honestly, I can't even remember because I deleted every solution that didn't work. But really, everything that I could think of. I covered at least every solution provided on forums and answer sites on the first page of Google after typing the error. I know this info isn't of much use, but really, I tried everything that I could think of. At least I remember that is not "dd/MM/yyyy" instead of the same but with dots. And that day, month, year is the order I want and the order that appears on the dataTable. I also tried some convert methods, adding stuff at the end of the sentence (Sorry, I really can't remember what) and stuff like that.


Solution

  • You are using different quotes. You use “dd.MM.yyyy” but you should use "dd.MM.yyyy". That should solve it.