Title: Sorting question with date data
Last modified: September 18, 2017

---

# Sorting question with date data

 *  Resolved [tneorg](https://wordpress.org/support/users/tneorg/)
 * (@tneorg)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/sorting-question-with-date-data/)
 * I think I almost have my citations table ready! The recent thread on date sorting
   brought about another issue for me. As you’ll see on my page the last column,
   dates are not perfectly consistent. I cannot find a way to get it to sort properly.
   Is this possible? Thanks!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fsorting-question-with-date-data%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/sorting-question-with-date-data/#post-9506134)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * The problem here are cells like “not recorded” and similar. Due to these, the
   sorting algorithm switches to string instead of date sorting.
    If you can’t replace
   these cells with a date, I recommend using the approach described at [https://wordpress.org/support/topic/tablepress-sorting-dates/#post-9471448](https://wordpress.org/support/topic/tablepress-sorting-dates/#post-9471448)
   You would basically have to add a second but hidden column for the dates, where
   these entries would get a fake date.
 * Regards,
    Tobias
 *  Thread Starter [tneorg](https://wordpress.org/support/users/tneorg/)
 * (@tneorg)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/sorting-question-with-date-data/#post-9506268)
 * Thanks. I’ve removed the text from the columns, but that hasn’t worked yet. Is
   it possible that all cells must have data in order to work?
 * Thanks!
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/sorting-question-with-date-data/#post-9506291)
 * Hi,
 * empty cells shouldn’t matter, from what I remember. However, the cell “0/0/1987”
   might also be a reason.
 * You could also try forcing date sorting, but adding this to the “Custom Commands”
   textfield on the “Edit” screen of the table:
 *     ```
       "columnDefs": [ { "type": "date", "targets": [ 10 ] } ]
       ```
   
 * Regards,
    Tobias
 *  Thread Starter [tneorg](https://wordpress.org/support/users/tneorg/)
 * (@tneorg)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/sorting-question-with-date-data/#post-9506391)
 * It was not the 0/0/1987 – It was simply adding the code you gave me above! Although
   the 0/0 did not sort at all, so I gave it a 1/1 and it is now in the list. Thanks
   yet again!
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/sorting-question-with-date-data/#post-9506408)
 * Hi,
 * no problem, you are very welcome! 🙂 Good to hear that this helped!
 * 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!

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

The topic ‘Sorting question with date data’ 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/)

 * 5 replies
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [8 years, 8 months ago](https://wordpress.org/support/topic/sorting-question-with-date-data/#post-9506408)
 * Status: resolved