WPIntell

Source evidence

Date sort

Table Sorter · support · 2018-01-31T09:14:00+00:00

mixedsentiment
mediumseverity
0.72relevance
4replies
Evidence onlycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

1 / 1 rows with source links

100.0% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

0 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
foscone resolved
Hi, is there a way to sort date-time column? If I try it sorts like: 01/11/2017 18:22 01/12/2017 05:40 01/12/2017 20:17 02/11/2017 10:31 02/11/2017 16:18 02/11/2017 17:38 02/12/2017 23:55 03/11/2017 16:07 03/11/2017 20:44 03/11/2017 22:01 … This dates are generated in php foreach: <table class="tablesorter {sortlist: [[0,0]]}"> <thead> <tr><th>Date</th></tr> </thead> <tbody> <?php foreach ( $sent_list as $lista ) { ?> <tr> <td> <?php $date= new DateTime($lista[ts]); echo $date->format('d/m/Y H:i'); ?> </td> </tr> <?php } ?> </tbody> </table> I can’t share link because is in a private area, sorry. Thanks Fosco This topic was modified 8 years, 3 months ago by foscone . I had the same problem and solved in modifying the jquery.tablesorter.min.js file where I changed the date format parameter as follow : dateFormat:”ddmmyyyy” This parameter is located near the begining of the php file. You may also be interested in another change if you want to sort numeric value with comma as decimal separator. Change the follwing parameter : usNumberFormat:!1 I hope this can help. Hi, To make your date columns sortable, add this class in your Date column head dateFormat-dd/mm/yyyy You should do it like this <th class="dateFormat-dd/mm/yyyy">Date</th> You can change date format according to your own need. Cheers. Happy coding! Not sure you shoud include the “/” in the dateFormat. ddmmyyyy should work Thank you, also for me <th class="dateFormat-ddmmyyyy">Date</th> works.

Comments

4 shown
dkolski 2018-02-01T19:40:00+00:00

I had the same problem and solved in modifying the jquery.tablesorter.min.js file where I changed the date format parameter as follow : dateFormat:”ddmmyyyy” This parameter is located near the begining of the php file. You may also be interested in another change if you want to sort numeric value with comma as decimal separator. Change the follwing parameter : usNumberFormat:!1 I hope this can help.

Farhan Noor 2018-02-03T07:23:00+00:00

Hi, To make your date columns sortable, add this class in your Date column head dateFormat-dd/mm/yyyy You should do it like this <th class="dateFormat-dd/mm/yyyy">Date</th> You can change date format according to your own need. Cheers. Happy coding!

dkolski 2018-02-03T12:35:00+00:00

Not sure you shoud include the “/” in the dateFormat. ddmmyyyy should work

foscone 2018-02-05T08:53:00+00:00

Thank you, also for me <th class="dateFormat-ddmmyyyy">Date</th> works.