I want to sort my excel based on H column “Fine Elaborazione” but in H column data is in general format this is why my sorting is not working can you try i am sharing my existing code for sorting
this is invoke code
inputDataTable.DefaultView.Sort=(“Nr. Fattura ASC, Fine Elaborazione DESC”)
finalDT = inputDataTable.DefaultView.ToTable
my excel data is not in date format so sorting is not happing perfectly.
I want to sort my excel based on H column “Fine Elaborazione” but in H column data is in general format this is why my sorting is not working can you try i am sharing my existing code for sorting
this is invoke code
inputDataTable.DefaultView.Sort=(“Nr. Fattura ASC, Fine Elaborazione DESC”)
finalDT = inputDataTable.DefaultView.ToTable
so this is the actual format
Fine Elaborazione
27-06-2023 22:31:36.373
24-05-2023 18:02:34.967
24-05-2023 12:37:06.797
14-10-2023 04:11:00.340
08-06-2023 12:45:18.667\
(From d in inputDataTable.AsEnumerable
Let ds = d("Fine Elaborazione").toString.Trim
Let dp = DateTime.ParseExact(ds,"dd-MM-yyyy HH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture)
Order by dp DESCENDING
Select r = d).CopyToDataTable
here my excel problem is this dates are coming in string format which conatins spaces in front and back of dates its taking like string i have tried filter data table but idid not work
check my execel attachment
can you try by linq and share me soultion in detail