title: Datatables ordering showing older dates before new
body: <p>I am using datatables v1.10 to display my data and for some reason, it is displaying older dates before new dates in the grid. I am using the correct syntax (I think) to order the data but it is not displaying in the correct order. I have tried both <code>asc</code> and <code>desc</code> and although it is changing the date order, i am confused as to why a newer date is inserted after an older date.</p>
  
  <p>Do I need to add <code>ORDER BY</code> to my <code>sql</code> or does dt ignore that?</p>
  
  <p>I have done screenshot to show problem and would be grateful if someone could point out my error. Many thanks</p>
  
  <p>js</p>
  
  <pre><code>$(function() {
    $('#nirqst').DataTable({
      "order": [[ 
        9, "desc" 
      ]],
      "columnDefs": [
      { 
        "orderable": false, 
        "targets": [ 10 ]
      },
      {
        className: "hide_id", 
        "targets": [ 0 ]
      }
  
    ],
      dom: 'lBfrtip',
      buttons: [{
        extend: 'print',
        exportOptions: {
          columns: [1, 2, 3, 4, 5, 6, 7, 8, 9]
        },
        title: 'New Intake Report',
        messageTop: 'This report was prepared for ' + usrname + ' on ' + rptDate,
        //text: 'Print current page',
        autoPrint: true,
        customize: function(win) {
          //      $(win.document.body).find('table').css({'background': 'red !important', 'font-size': '24px' });
          $(win.document.body).find('thead').css({
            'background': '#000',
            'font-size': '14px',
            'max-height': '30px'
          });
          $(win.document.body).find('tr:nth-child(odd) td').each(function(index) {
            $(this).css({
              'background-color': '#f7f7f7',
              color: 'black',
              padding: '12px 10px',
              'margin-left': '10px !important'
            });
          });
          $(win.document.body).find('tr:nth-child(even) td').each(function(index) {
            $(this).css({
              'background-color': '#fff',
              color: 'black',
              padding: '12px 10px',
              'margin-left': '10px !important'
            });
          });
          $(win.document.body).find('h1').css({
            'text-align': 'left',
            color: 'black',
            'margin-left': '36px',
            'margin-bottom': '7px',
            'font-size': '28px'
          });
        }
      }, 'copy', 'pdf', 'excel']
    });
    $("#nirqst_wrapper &gt; .dt-buttons").appendTo("#buttons");
  //  setInterval(function() {
  //table.ajax.reload();
  //}, 3000 );
  });
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/qGTmE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qGTmE.png" alt="enter image description here"></a></p>