Date field display

Asked

Viewed 65 times

1

I have a date in the format americado yyyy-mm-dd and I would like to put it in the Brazilian format dd-mm-yyyy but I don’t want to do it as conversion to_char. I need you to continue with the date format because I will need to make filters with date range and as a string the filter does not work. Poir this the need to change the position of the date, but remaining the type date.

BANCO POSTGRES

  • What is your sql server database?

  • So the bank I use is Postgres

  • 1

    I believe I should do the reverse then, pass the informed filter to date, ex: to_date('16012018', 'ddMMyyyy') the format applied by the bank is assigned by the Culture settings, and is indifferent in comparison

  • You are confusing the storage format of a date field with the display format. Rovann’s answer is correct, if it didn’t work it was because you applied it wrong.

  • One detail: the date format yyyy-mm-dd is the ISO format, the American format is mm/dd/yyyy.

  • Solved! Thank you guys!

Show 1 more comment

1 answer

0

You can set an environment variable called DATESTYLE for style GERMAN:

SET DATESTYLE = 'GERMAN';

Testing:

SELECT current_date;

Exit:

inserir a descrição da imagem aqui

  • Wow! I’ll do it!!! Thank you!!! :)

Browser other questions tagged

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