Search code examples
jquerytablesorter

How to sort date with tablesorter jQuery plugin in format dd mmm yy h:mm?


I'm using the tablesorter plugin of jQuery. I'm trying to sort a table which has column like 04 Aug 16 18:17. I tried:

$("#myTable").tablesorter({dateFormat: "dd mmm yy h:mm"});

and

$("#myTable").tablesorter({dateFormat: "uk"});

and

$("#myTable").tablesorter({dateFormat: "pt"});

and

$("#myTable").tablesorter({dateFormat: "ddmmyy"});

But nothing works, can someone help me?


Solution

  • Whats going wrong is that your using a date as a datetime. DateFormat suggests its for dates.

    A date has the following proppertys

    • day
    • month
    • year

    You dont have an hour and minute in a date, thats called a date time.