Date Sort not working Correctly
Date Sort not working Correctly
mountainclimber
Posts: 2Questions: 0Answers: 0
One easy way to solve this problem is to convert the format of the date in your SQL recordset to yyyy/MM/dd
SELECT convert(varchar, whatever_date, 111) as whatever_date
This will return date in yyyy/MM/dd format and that will cause datatables to sort the date column correctly
Replies
You can also use
DataTable.datetime()
to tell Datatables the format of your date field to allow for proper sorting. See the moment.js example and the Luxon example for more details.Kevin