Title: Not Sorting By Date
Last modified: September 1, 2016

---

# Not Sorting By Date

 *  Resolved [Josh Fisher](https://wordpress.org/support/users/mrjoshfisher/)
 * (@mrjoshfisher)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/not-sorting-by-date/)
 * Hello,
 * Im having an issue with a table on my site, I have several dates in a column 
   all formatted as dd/mm/yyyy and im using the code
 * `"aoColumnDefs": [ { "sType": "date", "aTargets": [ 3 ] } ]`
 * to sort it but for some reason when I click sort it sorts it in order except 
   for one date, it’ll go
 * 20/09/2016
    20/08/2016 19/09/2016
 * and as we all know the 8th comes before the 9th, any reason for this ?
 * [https://wordpress.org/plugins/tablepress/](https://wordpress.org/plugins/tablepress/)

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/not-sorting-by-date/#post-7705247)
 * Hi,
 * thanks for your question, and sorry for the trouble.
 * The reason for this is that this a dd/mm/yyyy date format. To sort those, please
   take a look at the TablePress Extension from [https://tablepress.org/extensions/datatables-sorting-plugins/](https://tablepress.org/extensions/datatables-sorting-plugins/)
   
   With that, you should not need that “Custom Command” either.
 * Regards,
    Tobias
 *  Thread Starter [Josh Fisher](https://wordpress.org/support/users/mrjoshfisher/)
 * (@mrjoshfisher)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/not-sorting-by-date/#post-7705251)
 * all the dates in the column are in the format dd/mm/yyyy and those without dates
   are just blank, but its still that one row with the date 20/08/2016 that comes
   in between the two dates, is it because there is a 0 before the month ?
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/not-sorting-by-date/#post-7705252)
 * Hi,
 * no, that 0 should not be an issue.
    Can you please post a link to the page with
   the table where this problem happens, so that I can take a direct look? Thanks!
 * Regards,
    Tobias
 *  Thread Starter [Josh Fisher](https://wordpress.org/support/users/mrjoshfisher/)
 * (@mrjoshfisher)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/not-sorting-by-date/#post-7705254)
 * [http://goo.gl/xFZJRo](http://goo.gl/xFZJRo) / NuclearPenguin and its New Opportunities
   section, deadline date column
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/not-sorting-by-date/#post-7705262)
 * Hi,
 * thanks for the link! This indeed seems to be due to the date formats (dd/mm/yyyy
   vs. the default mm/dd/yyyy).
    Now that you have installed the Extension, let’s
   set the format with this “Custom Command”:
 *     ```
       "columnDefs": [ { "type": "date-eu", "targets": [ 2 ] } ]
       ```
   
 * (Note that the 2 indicates the third column, as counting those starts with 0.)
 * Regards,
    Tobias
 *  Thread Starter [Josh Fisher](https://wordpress.org/support/users/mrjoshfisher/)
 * (@mrjoshfisher)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/not-sorting-by-date/#post-7705263)
 * Using the command stops the sort function on the column :/
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/not-sorting-by-date/#post-7705310)
 * Hi,
 * the problem now might be the empty values in that column. Can you maybe add a
   date to them for testing?
 * Regards,
    Tobias
 *  Thread Starter [Josh Fisher](https://wordpress.org/support/users/mrjoshfisher/)
 * (@mrjoshfisher)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/not-sorting-by-date/#post-7705465)
 * Hello, added the value 00/00/0000 in the empty fields but no joy still that 20/
   08/2016 that comes inbetween to other dates :/
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/not-sorting-by-date/#post-7705466)
 * Hi,
 * there are also “Not Specified” entries in that column that might be causing this.
   All cells in that column must contain a date format.
 * Regards,
    Tobias

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Not Sorting By Date’ is closed to new replies.

 * ![](https://ps.w.org/tablepress/assets/icon.svg?rev=3192944)
 * [TablePress - Tables in WordPress made easy](https://wordpress.org/plugins/tablepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tablepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tablepress/)
 * [Active Topics](https://wordpress.org/support/plugin/tablepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tablepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tablepress/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/not-sorting-by-date/#post-7705466)
 * Status: resolved