Date Column is now showing correct values after sorting the date column
Date Column is now showing correct values after sorting the date column
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
Try a forum search. Date sorting has been answered umpteen times in here.
A forum search is what brought me to this snarky, unhelpful answer.
There are many other answers. Find one you like.
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