Ordering columns with different date formats
Ordering columns with different date formats

My data table has two columns with different date formats. I wish to be able to sort either column by date. One column is formatted as 15 Oct 08 and I use DataTable.datetime('D MMM YY'). This column will sort correctly. The other column is formatted as 10 Feb 25 15:14 and will only sort as text.
The Ordering formatted dates (Moment.js) page (https://datatables.net/examples/datetime/order-moment.html) says:
Note that the parsing is strict - your assigned format must exactly match the data.
How can I sort the two columns with different date formats?
This question has an accepted answers - jump to answer
Answers
You can supply multiple formats. Use a second
DataTable.datetime(..)
statement for the second format.Kevin
Thank you. I wasn't sure if it was possible to have two different format statements. I have now added the second one and both sorts work.