Hi, I want to sort my DataTable in Ascending order. “04/21/2020 05:05 AM” this is the format. I used sort datatable but it is only sorting the numbers irrespective of AM PM. Here is how it looks but I want the result in reverse.
@Nahid_Sultana - welcome to community!
pls try below -
(From row In DTData Order By DateTime.ParseExact(row.Item(“COLUMNNAME”).ToString, “MM/dd/yyyy hh:mm:ss tt”,
System.Globalization.CultureInfo.InvariantCulture) Ascending Select row).CopyToDataTable
Hi,
I tried but this error Pops “Assign: String was not recognized as a valid DateTime.”
@Nahid_Sultana @GBK could you able to resolve this issue. Please share the logic to filter if found.
Thanks in advance.
@Midhuna - you can use assign activity and write below
SortedDt = (From row In DTData Order By DateTime.ParseExact(row.Item(“COLUMNNAME”).ToString, “MM/dd/yyyy hh:mm:ss tt”,
System.Globalization.CultureInfo.InvariantCulture) Ascending Select row).CopyToDataTable
- change the variables & column names accordingly
this throws the same error message as Nahid_sultana said. Any other way to filter it.
@Midhuna try this… I made small change in already given code:
dt.AsEnumerable.OrderBy(function(rw) CDate(rw("Column1").ToString))