Tip for local dates ordering (eg. FR)

Tip for local dates ordering (eg. FR)

GlaubuleGlaubule Posts: 2Questions: 0Answers: 0

_This example works with older Datatable versions.

1st select date from DB in 2 ways and name them :

SELECT  DISTINCT
DATE_FORMAT(date_add, "%d-%m-%Y %H:%i:%s") AS frdate,
DATE_FORMAT(date_add, "%Y-%m-%dT%H:%i:%sZ") AS jsdate,
...

2nd map your column data to 'jsdate' result

3rd define your column rendering in ColumnDefs this way

...
        render: function ( data, type, row ) {
                        return row.date;
        }
...

So display and data are separated

Replies

  • GlaubuleGlaubule Posts: 2Questions: 0Answers: 0

    Oups ! 3 step like this :

    ...
            render: function ( data, type, row ) {
                            return row.frdate;
            }
    ...
    
  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin

    Nice tip - thanks for posting that!

    Allan

This discussion has been closed.