6

I have a datatable that has a date column, but I am stumped as to how to sort it by that column. Any suggestions?

1 Answer 1

17
DataView view = DataTable.DefaultView;
view.Sort = "DateColumn";
3
  • That seems to sort it like a text field and not a date
    – Brad
    Commented Feb 5, 2009 at 0:18
  • Yes it was...I changed it to DateTime
    – Brad
    Commented Feb 5, 2009 at 0:50
  • It seems view.sort takes the date as a string. Bug in implementation by MS? Commented May 14, 2013 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.