Sort column with Date day/month/year
Sort column with Date day/month/year
fernandonaim
Posts: 9Questions: 0Answers: 0
Sorting column with date format: dd/mm/yyyy
I've tried several ways but without success.
Can anyone help me?
If you want you can answer in Portuguese!
I've tried several ways but without success.
Can anyone help me?
If you want you can answer in Portuguese!
This discussion has been closed.
Replies
[code]
jQuery.fn.dataTableExt.oSort['uk_date-asc'] = function(a,b) {
var ukDatea = a.split('/');
var ukDateb = b.split('/');
var x = (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1;
var y = (ukDateb[2] + ukDateb[1] + ukDateb[0]) * 1;
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};
jQuery.fn.dataTableExt.oSort['uk_date-desc'] = function(a,b) {
var ukDatea = a.split('/');
var ukDateb = b.split('/');
var x = (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1;
var y = (ukDateb[2] + ukDateb[1] + ukDateb[0]) * 1;
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};
[/code]