How to sort 2 columns by date with different format

How to sort 2 columns by date with different format

r2r_1310r2r_1310 Posts: 1Questions: 1Answers: 0
edited March 2018 in Free community support

I need to implement a DataTable with 2 different date format (one with dd/MM/yyyy HH:MM and other with dd/MM/yyyy). My code is this but it doesn't work...

$(document).ready(function () {
    $.fn.dataTable.moment('dd/MM/yyyy HH:MM');
    $.fn.dataTable.moment('dd/MM/yyyy');
    
    beginDataTable('x');
    beginDataTable('y');
    beginDataTable('z');
    enableChecks();
    $('#filterLabel').text('(Current Day)');
});

function beginDataTable(idTable) {
    $('#' + idTable + 'DT').DataTable({
        "language": {
            "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Spanish.json"
        }
    });
}

Can you help me to get solution or tell me what I'm doing wrong?

Thanks for your help. :)

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi,

    This thread here may give some clues, another user had problems and it turned out to be a combination of a badly defined format, and multiple formats within the same column. It would be worth checking that with your data.

    If that is all fine, it would be worth doing a live example here, so we can see the problems with the formatting.

    Cheers,

    Colin

This discussion has been closed.