sorting Month
sorting Month
Hello everyone!
so,I have a database on phpmyadmin and I wanna display one of my table's data into a datatable (PHP), everything works great except the column of sorting date dd/mm/yy: it sorts only by days without takig the month into account like that:
01/07/2015
03/08/2015
14/04/2015
23/09/2015
i've tried to use all the solutions i found in your site ( using aaSorting ,adding sorting functions (euro_date), specifying the type of the date column...) but to no avail !
so I'm wondering if someone could help me?
thx in advance for your answer :)
Answers
How is the date stored in your database - i.e. what date format?
in our database, the date is stored like that : "yyyy-mm-dd" and we use to_date (sql function) to make it and display it in this format "dd/mm/yyyy"
Hide a clean, sortable version of the date in another column and reference that hidden column for sorting purposes.
https://datatables.net/reference/option/columns.orderData
I think this is the 4th time tangerine and i have answered this "how do I sort funny data?" question this week.
If you use the search engine, search on "ordering" not "sorting"
Could you give me an example please?
https://datatables.net/forums/discussion/29812/custom-sorting-with-heavely-formated-date
That's kind of you! once i try it i'll inform you about the results :) thx again!
that was perfect thank you so much!
but the hidden column must be the first column in the table so it can be sortable.
thx thx thx