date and time field not showing as day/month/year time
date and time field not showing as day/month/year time
Hi, I am a compelte Knowbie so excuse my quesstion if it comes across dumb, i have created a small web application at the folliwng https://wireme.co.uk/BookList but i can not get the date to display correctly, not sure what i am doing wrong, please see my jason code below
function loadDataTable() {
dataTable = $('#DT_load').DataTable({
"ajax": {
"url": "/api/book",
"type": "GET",
"datatype": "json"
},
"order": [[0, "desc"]],
"columns": [
{ "data": "po", "width": "20%" },
{ "data": "creator", "width": "20%" },
{ "data": "company", "width": "20%" },
{ "data": "date", "width": "20%" },
{
"data": "po",
"render": function (data) {
return <div class="text-center">
<a href="/BookList/Edit?id=${data}" class='btn btn-success text-white' style='cursor:pointer; width:70px;'>
Edit
</a>
<a class='btn btn-danger text-white' style='cursor:pointer; width:70px;'
onclick=Delete('/api/book?id='+${data})>
Delete
</a>
</div>
;
}, "width": "40%"
}
],
"language": {
"emptyTable": "no data found"
},
"width": "100%"
});
}
Answers
What do you mean by "correctly"? What date/time format do you want?
EDIT: Just realised the clue is in the thread title.
You could create another column render function, or have a look at using moment.js
https://datatables.net/blog/2014-12-18#Operation