Thread: Date problem

Date problem

From
Marcelo Pereira
Date:
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_______________/



Re: Date problem

From
"Ricardo Ryoiti S. Junior"
Date:
    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.



Re: Date problem

From
Tom Lane
Date:
"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