Hello Everyone:
I am trying to sort datatable through column which contains data like this and I am getting this Error.
I am using query
->(From d In DT.AsEnumerable
Group d By d(“Col1”).ToString.Trim Into grp=Group
Select R=grp.OrderBy(Function (r) DateTime.ParseExact(r(“Date”).ToString,“dd/MM/yyyy hh:mm:ss”, System.Globalization.CultureInfo.InvariantCulture)).First()).CopyToDataTable
You would need to use Multiple date time formats for parsing. You could check the below posts on how to use the DateTime.ParseExact() with Multiple formats.
You could modify the DateTime.ParseExact() in your expression accordingly