I'm used to sort the date and time field in datatable plugin.but it not working it sort in the order of 9,8,7,...12,11,10. If I'm use some custom code for sorting I works but it is not sorting for some data's
Custom code:
HTML and JS
<td><?= $date ? $date : '-' ?></td>
jQuery.fn.dataTableExt.oSort['uk_date-pre'] = function(a) {
var a = a.split('m')[0];
a=a+'m';
a = a.slice(0, -2) + ' ' + a.slice(-2);
var date = Date.parse(a);
return typeof date === 'number' ? date : -1;
}
datatable:
$('#id').DataTable({
"paging": true,
"ordering": true,
"aoColumns": [
{ "bSortable": false },
{ sType: 'uk_date' },
null
],
"order": [[0, 'desc']],
});
Finally i got the answer thanks you for all for your comments