Formatting mysql date in column
Formatting mysql date in column
James Payne
Posts: 15Questions: 0Answers: 0
Hello,
how can I format a date column I have that lists mysql dates from my database? I'm using server-side processing to get the details from my db.
I would like to turn 2010-04-27 into 27th April 2010.
So far I have...
[code]"aoColumnDefs": [
{ "bSearchable": false, "aTargets": [ 2 ] },
{ "fnRender": function ( oObj ) {
return oObj.aData[4];
},
"aTargets": [ 4 ]
}
],[/code]
...but I'm not sure what function I need to do this.
Can anyone help?
Thanks
how can I format a date column I have that lists mysql dates from my database? I'm using server-side processing to get the details from my db.
I would like to turn 2010-04-27 into 27th April 2010.
So far I have...
[code]"aoColumnDefs": [
{ "bSearchable": false, "aTargets": [ 2 ] },
{ "fnRender": function ( oObj ) {
return oObj.aData[4];
},
"aTargets": [ 4 ]
}
],[/code]
...but I'm not sure what function I need to do this.
Can anyone help?
Thanks
This discussion has been closed.
Replies
var dWhen = new Date(1000 * oObj.aData[oObj.iDataColumn]);
return dWhen.toLocaleTimeString()
or whatever function to print a date in the format you want.
Hth,
Gerardo
[code]
$aColumns = array( 'DATE_FORMAT(date_in,"%Y-%m-%d")', 'url', 'notes', 'user');
[/code]