Display only date from a datetime value

Display only date from a datetime value

half_fullhalf_full Posts: 1Questions: 0Answers: 0
edited July 2011 in General
Hi,

First of all, many thanks to Allan for creating such a useful library!

I'm using server side processing as per the Django example. I return datetime values in this format 'yyyy-mm-dd hh:mm:ss'. These date time values are currently displayed like this (for example):

Dec. 18, 2011, 11:59 p.m.

I would like to display just the date part rather than both date and time.

This is what I have in my html page:

[code]

/* <![CDATA[ */
$(document).ready(function() {
$('#certs-table').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/cars/get_cars_list/",
"iDisplayLength": 10,
"aoColumnDefs": [
{ "aTargets": [0], "bVisible": false, "bSearchable": false},
{
"aTargets": [1],
"fnRender": function ( oObj ) {
return '' + oObj.aData[1] + '';
},
"bSearchable": true,
},
{ "aTargets": [2], "bSearchable": true},
{ "aTargets": [3], "bSearchable": false, "sType": 'date'},
]
});
} );
/* ]]> */

[/code]

The date is is the 4th column, i.e., aTarget[3].

How do I display just the date portion please? I only started using DataTables yesterday, so would really appreciate some example code .

Many thanks!
This discussion has been closed.