Date Column is now showing correct values after sorting the date column

Date Column is now showing correct values after sorting the date column

ankitdwivediankitdwivedi Posts: 1Questions: 1Answers: 0

I am using bootstrap 3 data table all the fields sorting are working perfectly except the date column. I've changed the date format using the php date format function <?php echo date('jS M, Y', strtotime($creditleave->CreditDate));?>. The actual date which am getting from the db through this variable "$creditleave->CreditDate" (YYYY-MM-DD) and I have changed it to like this (2nd Feb 2017). The date column sorting is working good in this (YYYY-MM-DD)
format, but after changing it to (2nd Feb 2017) it is not working. If anyone can help please do reply soon got stuck with this issue. plz....

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Try a forum search. Date sorting has been answered umpteen times in here.

  • goodhandedgoodhanded Posts: 1Questions: 0Answers: 0

    A forum search is what brought me to this snarky, unhelpful answer.

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    There are many other answers. Find one you like.

  • allanallan Posts: 63,893Questions: 1Answers: 10,531 Site admin

    This blog post describes the issue and also introduces a plug-in for how to address it (and indeed sorting for any date / time formatted string - using the awesome MomentJS library).

    There are other options in the sorting plug-ins, but that is the key one and I'll probably build it into DataTables core in future.

    Allan

This discussion has been closed.