I am using datatables v1.10 and need to format date to dd/mm/yyyy h:i:s format. I have tried various suggestions that I have foumd on SO and google but nothing sems to work My latest effort is attached and just changes all dates to: 7-2-2011
. My date format that is being returned is: intkdate 2011-03-07 16:12:39
. I am confused as to why it is changing the date and would be grateful if someone could point out my error.
I know this question will get downvoted but I cannot find a better alternative for a title. Many thanks
"columns": [
{ mData: 'id' } ,
{ mData: 'box', 'width': '40' },
{ mData: 'intkdate'},
{ mData: 'destdate' },
{ "mData": null, 'width': '110' }
],
"columnDefs": [
{
targets: 2,
"render": function (data) {
var date = new Date(data);
return date.getDate() + "-"+date.getMonth()+"-" + date.getFullYear();
}
},