Date Sorting issue: saved db field as YYYY-MM-DD; need table display and sort as DD-MM-YYYY

Date Sorting issue: saved db field as YYYY-MM-DD; need table display and sort as DD-MM-YYYY

alzamboalzambo Posts: 38Questions: 17Answers: 1

Hi,
I have a mysql date field that is saved, for example, as 2015-06-26 and I need to display and sort it in a datatable as 26-06-2015.

I think that "it's not rocket science" but I've read a bunch of articles without understand where I should start from (server-side, some plugin or not, moment, etc).

This is my debug code: aninog and, if needed, i will post my code.
Alex

This question has an accepted answers - jump to answer

Answers

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

    Either (back end) use MySQL's DATE_FORMAT function when retrieving data,
    or (front end) use DataTables' "render" function to reformat the data for display.

  • alzamboalzambo Posts: 38Questions: 17Answers: 1

    Yeah!
    So simple... thank you!

This discussion has been closed.