Sort date excel

@Stef_99

I can see in your output panel date format is change to d/M/yyyy HH:mm

dt_Input = dt_Input.AsEnumerable().OrderBy(Function(x) DateTime.ParseExact(x("Planned Start").ToString,"d/M/yyyy HH:mm",System.Globalization.CultureInfo.InvariantCulture)).CopyToDataTable

Try above query, I have just change in input date format!
If this gives error then try below mentioned query:

dt_Input = dt_Input.AsEnumerable().OrderBy(Function(x) DateTime.ParseExact(x("Planned Start").ToString,"M/d/yyyy HH:mm",System.Globalization.CultureInfo.InvariantCulture)).CopyToDataTable

Hope above query will resolve your issue, or after the error in immediate panel put dt_Input(11)("Planned Start") and dt_Input(12)("Planned Start") just send me a screenshot so that I will get an idea about your date format!

Regards,
Ajay Mishra

5 Likes