Title: Dates Not Sorting Correctley
Last modified: August 21, 2016

---

# Dates Not Sorting Correctley

 *  Resolved [cmsnet](https://wordpress.org/support/users/cmsnet/)
 * (@cmsnet)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/dates-not-sorting-correctley/)
 * Hello Tobias,
 * My apologies if this has already been covered in another thread.
 * I am having trouble getting dates in columns to sort correctly from the earliest
   date to the latest date and vice versa.
 * So far I have:
 * Installed: WordPress
    Installed: Tablepress Installed: DataTables Sorting plugins
   Extension 1.0 Created a test table with dates in the format: dd/mm/yyyy Added
   the table to a webpage
 * I have tried adding the following code one at a time to the Custom Command:
 * “aaSorting”: [[4,’asc’]]
 * “aoColumnDefs”: [ { “sType”: “date-eu”, “aTargets”: [ 4 ] } ], “aaSorting”: [[
   4,’asc’]]
 * Here is the link to the test table:
 * [http://www.table.cmsnetdesign.com.au/contractors-ticket-expiry/](http://www.table.cmsnetdesign.com.au/contractors-ticket-expiry/)
 * Any help would be greatly appreciated. Thanks.
 * [https://wordpress.org/plugins/tablepress/](https://wordpress.org/plugins/tablepress/)

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

 *  Thread Starter [cmsnet](https://wordpress.org/support/users/cmsnet/)
 * (@cmsnet)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/dates-not-sorting-correctley/#post-4762766)
 * Hello Tobias,
 * I think I have managed to resolve the above issue.
 * I finally found a thread where you suggested pasting the following code:
 * “aoColumnDefs”: [ { “sType”: “date-eu”, “aTargets”: [ 1,2 ] } ]
 * The code was pasted here:
 * Tablepress,
    Table Name, Edit, Features of the Data Tables Java Script Library(
   bottom of page) Custom Commands
 * The above code was not initially working because I was unaware that the column
   numbering begins at 0.
 * Once I understood that [ 1,2 ] represent the columns that have date fields everything
   worked just fine.
 * Thank you for such a great Worpress plugin.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/dates-not-sorting-correctley/#post-4762791)
 * Hi,
 * thanks for your question, and sorry for the trouble.
 * Great to hear that you already found the solution. 🙂 You’ll indeed just have
   to set the data type to European dates here with the columns numbers starting
   from 0.
 * Best wishes,
    Tobias

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

The topic ‘Dates Not Sorting Correctley’ 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/)

 * 2 replies
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/dates-not-sorting-correctley/#post-4762791)
 * Status: resolved