Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I am using datatable jquery api. I have a table which contains a date column, of which, data are in text format i.e. August 2nd, 2016. Here, the column is sorted in alphabetical order not according to the dates. What should I do ?
August 2nd, 2016
First, convert the dates using following line of code.
$timeStamp = strtotime('August 2nd, 2016');
Then, in the date column in your table, use this line of code.
<td data-order="<?php echo $timeStamp; ?>">August 2nd, 2016</td>
Add a comment
try this in aoColumns;
{ sTitle: "Date", mData: "StartTime", mRender: function (data) { return data == null ? "" : '<span style="display:none;">' + new Date(data).getTime() + '</span>' + new Date(data).toLocaleString(); } },
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.