Date problem

Started by Marcelo Pereiraalmost 24 years ago3 messagesgeneral
Jump to latest
#1Ricardo Ryoiti S. Junior
suga@netbsd.com.br
In reply to: Marcelo Pereira (#2)
Re: Date problem

Ola,

On Mon, 27 Jan 2003, Marcelo Pereira wrote:

How can I make PostgreSQL to use dates as DD/MM/YYYY ????

I use "SET DATESTYLE TO SQL,EUROPEAN" as soon as the connection is
made.

[] s
Ricarod.

#2Marcelo Pereira
gandalf@sum.desktop.com.br

Hi everybody,

I am in troubles with a DATE field. Here, in Brazil, we use to write dates
as DD/MM/YYYY, so to insert a tuple today I'd execute:

INSERT INTO test (iDate) VALUES ('27/01/2003');

But it will result in 01/27/2003... and an error is showed on the
screen. When I have dates as 10th May, I would use 10/05/2003, but it will
be inserted on the database as 05/10/2003. Note it will not output an
error, but my data will be inconsistent.

How can I make PostgreSQL to use dates as DD/MM/YYYY ????

Thanks in advance and
Best Regards,

Marcelo Pereira

-- Remember that only God and ^[:w saves.
__
(_.\ � Marcelo Pereira |
/ / ___ marcelo@pereira.com |
/ (_/ _ \__ [Math|99]-IMECC |
_______\____/_\___)___Unicamp_______________/

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Ricardo Ryoiti S. Junior (#1)
Re: Date problem

"Ricardo Ryoiti S. Junior" <suga@netbsd.com.br> writes:

On Mon, 27 Jan 2003, Marcelo Pereira wrote:

How can I make PostgreSQL to use dates as DD/MM/YYYY ????

I use "SET DATESTYLE TO SQL,EUROPEAN" as soon as the connection is
made.

In 7.3 you can set that as the default datestyle in postgresql.conf.
There are klugier ways of making it the default in prior releases
(PGDATESTYLE env. variable or -e postmaster switch, if memory serves).

regards, tom lane