User36583972 posted
Hi MedNasser,
How can i fix that and display it like it is in the database?
I have tried this function and it works but it's lacking 0's in the date format therefore it cannot be sorted or filtered in the datatable.
You can JQuery.render function and convert the datetime to the specified template.
JQuery.render render HTML views based on the specified templates and data. It can automatically process all kinds of data, including collections, JSON objects.
$(function() {
var table = $('#myTable').DataTable({
data: datas.rows,
"columns": [{
title: "Time",
data: "Datetime",
render: function(d) {
return moment(d).format("DD:MM:YYYY HH:mm:ss");
}
}, {
title: "Temperature",
data: "Temperature"
}
]
});
})
Best Regards,
Yong Lu