Sorting Dates not working properly

Sorting Dates not working properly

TablesForDataTablesForData Posts: 3Questions: 1Answers: 0
edited August 2015 in Free community support

When I sort a column that has dates in the format of 4/30/2015 9:55 AM PT the sort is not correct by the dates.

example:
a column of all days for a month sorted in Descending order will end up like this

4/9/2015 9:55 AM PT

4/8/2015 9:55 AM PT

4/7/2015 9:55 AM PT

4/6/2015 9:55 AM PT

4/5/2015 9:55 AM PT

4/4/2015 9:55 AM PT

4/30/2015 9:55 AM PT

4/3/2015 9:55 AM PT

4/29/2015 9:55 AM PT

4/28/2015 9:55 AM PT

4/27/2015 9:55 AM PT

4/26/2015 9:55 AM PT

4/25/2015 9:55 AM PT

4/24/2015 9:55 AM PT

4/23/2015 9:55 AM PT

4/22/2015 9:55 AM PT

4/21/2015 9:55 AM PT

4/20/2015 9:55 AM PT

4/2/2015 9:55 AM PT

4/19/2015 9:55 AM PT

4/18/2015 9:55 AM PT

4/17/2015 9:55 AM PT

4/16/2015 9:55 AM PT

4/15/2015 9:55 AM PT

4/14/2015 9:55 AM PT

4/13/2015 9:55 AM PT

4/12/2015 9:55 AM PT

4/11/2015 9:55 AM PT

4/10/2015 9:55 AM PT

4/1/2015 9:55 AM PT

Is there something I am missing that will fix this?

This question has an accepted answers - jump to answer

Answers

  • zeinerrjzeinerrj Posts: 11Questions: 1Answers: 2
    Answer ✓

    Hello TablesForData,

    Your information is being sorted as text, which is the default for Datatables. The Datatables documentation will show you how to let Datatables know that a column contains date information. It should sort correctly after that.

  • TablesForDataTablesForData Posts: 3Questions: 1Answers: 0

    That is what I was assuming but I have not been able to find the information on the documentation regarding telling Datatables that the column is a date. I will keep digging.

  • TablesForDataTablesForData Posts: 3Questions: 1Answers: 0

    I finally found the information needed to accomplish this at http://datatables.net/reference/option/columns.type

This discussion has been closed.