In my form I am using Bootstrap-Datepicker
so that the user can enter the desired date at the time of registration, it works correctly, but at the moment of making a change I am trying to bring the date in the format 99/99/9999
with the DATE_FORMAT()
command via MySQL
and return the data via Json
but the dates are not being converted and are not being placed in the respective fields, my select is like this:
SELECT *, DATE_FORMAT(DataInicial,'%d/%m/%Y') AS DataInicial, DATE_FORMAT(DataFinal,'%d/%m/%Y') AS DataFinal FROM agendaMural WHERE IdAgenda = 2448
But my console.log
shows me this result, the dates are not being converted, I already tried the alternatives I knew, see how it is:
Thepagewiththereturncodeisthis:
if(jQxhr.responseText!="[]") {
try {
if (jQxhr.readyState === 4) {
if (jQxhr.status === 200) {
var nota = JSON.parse(jQxhr.responseText);
//Atribui valores aos campos
$('#idUnidade').val(nota[0].idUnidade);
$('#IdDepartamento').val(nota[0].IdDepto);
$('#dDataInicial').val(nota[0].DataInicial);
$('#dDataFinal').val(nota[0].DataFinal);
$('#dHoraInicial').val(nota[0].HoraInicial);
$('#dHoraFinal').val(nota[0].HoraFinal);
$('#sAssunto').val(nota[0].Assunto);
$('#sLocal').val(nota[0].Local);
$('#sDescricao').val(nota[0].Descricao);
} else {
var dialogInstance = BootstrapDialog.show({
title: 'ERRO',
type: BootstrapDialog.TYPE_DANGER,
message: 'Ocorreu um erro na requisição dos dados. Tente novamente.'
});
}
}
}