jquery - Table sorting for DD-MM-YYY hh:mm:ss not working -


i have problem sorting datetime format dd-mm-yyy hh:mm:ss. tried several codes found online , none of them worked. knows where's problem?

here code using:

("#resultstable").tablesorter({     2: {         sorter: "shortdate",         dateformat: "uk"     } }); 

you can addparser code given below, convert time numeric value , sort.

$.tablesorter.addparser({      id: 'date_column', // id of date column     is: function(s) {          return false;      },      format: function(s) { // convert datetime timestamp         var dateparts = s.match(/(\d+)-(\d+)-(\d+) (\d+):(\d+)/);         date = new date(dateparts[3], parseint(dateparts[2], 10) - 1, dateparts[1], dateparts[4], dateparts[5]);         return date.gettime();              },      type: 'numeric'  });  

this sample code how sort following date format

17-09-2013 10:08 date-month-year hour(24):minute 

you need convert way need, more information refer this question.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -