i am sending the date as string from server as explained below which has both date and time part like 2010-12-07 17:35:04.127. what i want is just display the date not the time part in data table column i.e 2010-12-07. But also i want the sorting happens on complete date including the time part. So customer created at 2010-12-07 18:35:04.12 should be displayed above 2010-12-07 17:35:04.12 in dataTable column. here is my specific date column code snippet in datatable
"aoColumns": [ { "mDataProp": "customerCreated","bSearchable": false,
"fnRender": function ( o, val )
{
var javascriptDate = new Date(o.aData["customerCreated"]);
javascriptDate = javascriptDate.getFullYear()+"/"+javascriptDate.getMonth()+"/"+javascriptDate.getDate();
return "<div class= date>"+javascriptDate+"<div>";
}
} ]
Issues i am facing are:-
1)On IE and Mozilla date is displayed as NaN/NaN/NaN. Not getting why?
2)On Chrome date is displayed but month is displayed decremented by 1.Why javascriptDate.getMonth() return month decremented by 1?
3)i am not sure sorting will work if take above route where i am displaying just date part but want sorting to happen on complete date including date part?
FYI i am using the bserverSide as false .Basically i am getting the data from server in one go and do the sorting on client side?