javascript - JQuery Datatable Sort Date column in a simple way -


my date column not sorting properly, looks sorting normal number , not proper date column.

i use javascript below datatables have in application, generic all, that's why don't set columns information, leave selected automatic datatable. in way possible make date column sort correctly? or have set such column format?

 table.datatable({                 statesave: true,                 "blengthchange": false,                 "bfilter": searchable,                 "columndefs": [{                     "orderable": false,                     "targets": [0]                 }],                 "order": [                     [1, 'asc']                 ],                 "bsort": true,                 "lengthmenu": [                     [10, 20, 50, 100, 150, -1],                     [10, 20, 50, 100, 150, "all"]                 ],                 "idisplaylength": 10,                 "pagelength": 10             }); 

below view, use mvc

  <table class="table table-bordered" id="datatablelist">          <thead class="heading">             <tr>                 <th class="table-checkbox"><input type="checkbox" class="group-checkable" /></th>                 <th>id</th>                 <th>date</th>                 <th>account name</th>             </tr>         </thead>          <tbody>              @foreach (var item in model.alllabourcharges.orderbydescending(x => x.date))             {                 <tr>                     <td><input type="checkbox" class="checkboxes" value="@item.id" /></td>                     <td>@html.actionlink(item.id.tostring(cultureinfo.invariantculture).padleft(4, '0'), "form", new { item.id })</td>                     <td>@item.date.date.tostring(generalhelper.dateformat)</td>                     <td>@html.emptyifnull(x => item.account.accountname)</td>                 </tr>             }          </tbody>     </table> 

below references:

<script src="~/content/assets/global/plugins/select2/select2.min.js" type="text/javascript"></script> <script type="text/javascript" src="~/content/assets/global/plugins/datatables/media/js/jquery.datatables.min.js"></script> <script type="text/javascript" src="~/content/assets/global/plugins/datatables/extensions/colreorder/js/datatables.colreorder.min.js"></script> <script type="text/javascript" src="~/content/assets/global/plugins/datatables/extensions/scroller/js/datatables.scroller.min.js"></script> <script type="text/javascript" src="~/content/assets/global/plugins/datatables/plugins/bootstrap/datatables.bootstrap.js"></script> 

you need define columns first.