In postgres I have a table with date column. Now postgres allows me to write date in Y-m-d format. But I need date in d/m/Y format. How to change it?
When I do:
If at all possible, don't use DATESTYLE. It'll affect all code in your session, including things like stored procedures that might not be expecting it and might not have set an explicit overriding DATESTYLE in their definitions.
If you can, use to_char for date output, and to_timestamp for date input whenever you need to use any date formats that might be ambiguous, like D/M/Y. Use ISO dates the rest of the time.