Problem with MYSQL data formatting

Asked

Viewed 29 times

0

I am making a hotel management system using Javascript, Nodejs, Express and MYSQL. I need my date format to be DAY/MONTH/YEAR, this way:

DATE_FORMAT(dt_entrada, '%d/%m/%Y')
DATE_FORMAT(dt_saida, '%d/%m/%Y')

My SQL code is like this

SELECT id_reserva, quarto.num_quarto, nome, DATE_FORMAT(dt_entrada, 
'%d/%m/%Y'), DATE_FORMAT(dt_saida, '%d/%m/%Y') from reserva, quarto, cliente 
WHERE reserva.id_cliente = cliente.id_cliente and reserva.num_quarto = 
quarto.num_quarto

However, when I do a console.log(Rows), it appears to me this. inserir a descrição da imagem aqui

The name of the property of my database ends up changing to DATE_FORMAT... Since it is dt_input and dt_output.

1 answer

2


Try adding an alias, ex: DATE_FORMAT(dt_input, '%d/%m/%Y') as dt_input

Browser other questions tagged

You are not signed in. Login or sign up in order to post.