datatable date sorting dd MMM yyyy ; hh:mm:ss

datatable date sorting dd MMM yyyy ; hh:mm:ss

walterhunkwalterhunk Posts: 10Questions: 4Answers: 0

Hi,
I am using DataTables plugin.
I am displaying a bunch of columns in the datatables. I ahve applied column sorting for all the columns. The soring is working perfectly fine for all the columns except for the column in which date is displayed in the format dd MMM yyyy ; hh:mm:ss
This is being considered as a string and the column is getting sorted as per that assumption.

For example,
Lets say the column contains the following values

20 Feb 2015 ; 17:20:00 hrs
09 Feb 2015 ; 10:36:48 hrs
21 Jan 2015 ; 17:20:00 hrs

If i sort the column in ascending order, the result is as follows
09 Feb 2015 ; 10:36:48 hrs
20 Feb 2015 ; 17:20:00 hrs
21 Jan 2015 ; 17:20:00 hrs

but the correct result should be

21 Jan 2015 ; 17:20:00 hrs
09 Feb 2015 ; 10:36:48 hrs
20 Feb 2015 ; 17:20:00 hrs

Please provide any solution to solve this issue.

Thanks in advance.

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.