0
I am mounting a table on the datatables with date and time information. But the data comes in the database in YYYY-mm-dd default. How do I change and show in datatable as dd/mm/YYYY?
My code:
function retornarColetas(data) {
var coletas = "";
$.each(data, function (chave, valor) {
coletas += '<tr>' +
'<td>' + valor.id_coleta + '</td>' +
'<td>' + valor.cliente + '</td>' +
'<td>' + valor.data + '</td>' +
'<td>' + valor.hora + '</td>' +
'<td>' + valor.vendedor + '</td>' +
'<td>' + valor.status + '</td>' +
'<td>' +
'<a class="btn btn-sm btn-outline-info text-info mr-2"><i class="fas fa-pencil-alt"></i> Editar</a>' +
'<a class="btn btn-sm btn-outline-danger text-danger"><i class="far fa-trash-alt"></i> Excluir</a>' +
'</td>';
});
$('#tabelaColeta').html(coletas);
}
This answers your question? How to format date in javascript?
– Rafael Tavares