Title: Sort by Date Method?
Last modified: November 13, 2018

---

# Sort by Date Method?

 *  Resolved [Steven](https://wordpress.org/support/users/shyzer/)
 * (@shyzer)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/sort-by-date-method/)
 * Hey Tobias, quick question. How do you sort by date using mm/dd/yyyy?
 * I have a [test page with an example](https://www.heyitsfree.net/test-page/) of
   my table. If I sort by date, it starts using the month instead of the year.
 * I looked through the Extensions, but none of them seemed to address this. Apologies
   if I overlooked it.
 * Thanks!

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

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/sort-by-date-method/#post-10875224)
 * Hi,
 * thanks for your question, and sorry for the trouble.
 * I’m not sure why the date sorting is not working here out of the box (as it should)
   but we can try to force it. For that, please add this to the “Custom Commands”
   text field on the table’s “Edit” screen:
 *     ```
       "columnDefs": [ { "type": "date", "targets": [ 3 ] } ]
       ```
   
 * Regards,
    Tobias
 *  Thread Starter [Steven](https://wordpress.org/support/users/shyzer/)
 * (@shyzer)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/sort-by-date-method/#post-10876722)
 * Tobias, you are the freaking best! That custom command forced the dates to sort
   exactly as I wanted.
 * Just so I understand, what is the 3 referencing in the custom command?
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/sort-by-date-method/#post-10876819)
 * Hi,
 * no problem, you are very welcome! 🙂 Good to hear that this helped!
 * The 3 is referring to the fourth column of the table (which has the dates, in
   your table). As counting starts with 0 in this code, column 4 is indicated by
   that 3.
 * Best wishes,
    Tobias
 *  Thread Starter [Steven](https://wordpress.org/support/users/shyzer/)
 * (@shyzer)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/sort-by-date-method/#post-10877283)
 * Ahh, that makes perfect sense. Thanks again!
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/sort-by-date-method/#post-10877439)
 * Hi,
 * sure! Always happy to help!
 * Best wishes,
    Tobias
 *  [dfarin](https://wordpress.org/support/users/dfarin/)
 * (@dfarin)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/sort-by-date-method/#post-10931463)
 * Hey Tobias, i have an similar Problem here. When u need the Website we have to
   gp in a privat chat, because ist just a dev site for now.
    I created a table 
   with 3 columns, Date | Description | Another text. In the first column is the
   date in european format dd.mm.yyyy Now i install your additional addon Datatables
   and fill custom commands with: “columnDefs”: [ { “type”: “date”, “targets”: [
   0 ] } ] Do i have to add an special command for european/german date ? Because
   presently it isnt working.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/sort-by-date-method/#post-10933224)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * To use the German/European format, you’ll just need a small change now:
 *     ```
       "columnDefs": [ { "type": "date-eu", "targets": [ 0 ] } ]
       ```
   
 * Regards,
    Tobias
 *  [dfarin](https://wordpress.org/support/users/dfarin/)
 * (@dfarin)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/sort-by-date-method/#post-10933379)
 * Works fine!
    Thanks a lot Tobias. Perhaps put it in ur FAQ or example, i searched
   ur whole site for it 😀
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/sort-by-date-method/#post-10933440)
 * Hi,
 * no problem, you are very welcome! 🙂 Good to hear that this helped!
 * Yes, I should probably add this to the Extensions’ web page.
 * Best wishes,
    Tobias
 * P.S.: In case you haven’t, please [rate TablePress](https://wordpress.org/support/plugin/tablepress/reviews/#new-post)
   here in the plugin directory. Thanks!
 *  [doughballs](https://wordpress.org/support/users/doughballs/)
 * (@doughballs)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/sort-by-date-method/#post-11240321)
 * Hi Tobias,
 * Can I jump in here with a similar query? Firstly, my date format is yyyy-mm-dd,
   and so far ‘date’ and ‘date-eu’ haven’t worked for me:
 * “columnDefs”: [ { “type”: “date-eu”, “targets”: [ 2 ] } ]
    “columnDefs”: [ { “
   type”: “date”, “targets”: [ 2 ] } ]
 * My dates are in column 3. I had a quick google reagrding my date format, and 
   it looks like I’m using the Danish standard?! I’m guessing I need to use the 
   suffix for this part of the world, but I don’t know what that is in your extension!
 * Awesome plugin by the way 🙂
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/sort-by-date-method/#post-11240334)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * The format `yyyy-mm-dd` could actually work out of the box. And actually, we 
   might not even need a date sorting algorithm, but can sort this as text strings–
   which actually is the default already…
    Can you please post a link to the page
   with the table where this problem happens (without any of the “Custom Commands”
   from above), so that I can take a direct look? Thanks!
 * Regards,
    Tobias
 *  [doughballs](https://wordpress.org/support/users/doughballs/)
 * (@doughballs)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/sort-by-date-method/#post-11241427)
 * Hi Tobias – ha, no need at all to apologise, thanks for your speedy response!
   Is there a way I can share the link privately?
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/sort-by-date-method/#post-11241524)
 * Hi,
 * could you send it by email then? The address is in the main plugin file “tablepress.
   php”.
 * Regards,
    Tobias

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

The topic ‘Sort by Date Method?’ 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/)

## Tags

 * [date](https://wordpress.org/support/topic-tag/date/)
 * [sort](https://wordpress.org/support/topic-tag/sort/)

 * 13 replies
 * 4 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [7 years, 3 months ago](https://wordpress.org/support/topic/sort-by-date-method/#post-11241524)
 * Status: resolved