Format date when performing Update in the registry - PostgreSQL

0

I am saving in my database the date when a particular record is changed, but the format it is saved is (YYYY-MM-DD) , the SQL command used so far is the following:

update public.transportadora set status = 'Ativo', user_update = 'Teste', data_alteracao = current_date where codigo = 3

and the registry looks like this:

My need is for the date to be in the DD-MM-YYYY sequence, ie 27/03/2017     

asked by anonymous 27.03.2017 / 22:20

2 answers

2

At the database level, if you selected this field as a date or timestamp field you do not format the date, who does this is the database itself, what you can do is take that data and format it programmatically, for example in java can use SimpleDateFormat in php if I am not mistaken it has the function date() ; It tells you what language you are using that someone will give you a more accurate answer.

    
27.03.2017 / 22:25
0

When displaying use: to_char(seu_campo_data, 'DD-MM-YYYY')

    
31.03.2017 / 19:48