Обсуждение: setting default date format

Поиск
Список
Период
Сортировка

setting default date format

От
Gary Stainburn
Дата:
Hi folks,

I'm kicking myself (gently) cos I can't remember/find how to do this.

I want to set the default date format to european dd-mm-yyyy format.

I can remember that I used to do it by adding '-o -e' to the command line
parameters but that was frowned upon a long time ago to be replaced by an
entry in a config file (postgresql.conf?).

Can someone tell me which file, and what I need to add.

Thanks

Gary
--
Gary Stainburn

This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000


Re: setting default date format

От
Oliver Elphick
Дата:
On Wed, 2003-10-01 at 10:41, Gary Stainburn wrote:
> I want to set the default date format to european dd-mm-yyyy format.

> Can someone tell me which file, and what I need to add.

In postgresql.conf:

DATESTYLE = 'Postgres,European'

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                             http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "Yet if any man suffer as a Christian, let him not be
      ashamed; but let him glorify God on this behalf."
                                        I Peter 4:16


Re: setting default date format

От
Peter Eisentraut
Дата:
Gary Stainburn writes:

> I can remember that I used to do it by adding '-o -e' to the command line
> parameters but that was frowned upon a long time ago to be replaced by an
> entry in a config file (postgresql.conf?).

datestyle in postgresql.conf, starting in PostgreSQL 7.3.  -o -e should
still work, though.

--
Peter Eisentraut   peter_e@gmx.net


Re: setting default date format

От
Gary Stainburn
Дата:
On Wednesday 01 October 2003 11:13 am, Oliver Elphick wrote:
> On Wed, 2003-10-01 at 10:41, Gary Stainburn wrote:
> > I want to set the default date format to european dd-mm-yyyy format.
> >
> > Can someone tell me which file, and what I need to add.
>
> In postgresql.conf:
>
> DATESTYLE = 'Postgres,European'

Hi Oliver,

When I did this, and then did 'service postgresql restart' the service failed
to start.

I have managed to get it working by amending the pg_ctl command in
/etc/rc.d/init.d/postgresql to add

-o '-o -e'

but as I said before I seem to remember that this was frowned upon because the
next time I upgrade it'll get overridden.

BTW, I'm running 7.2.3 from the RH RPMS.
--
Gary Stainburn

This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000


Re: setting default date format

От
Oliver Elphick
Дата:
On Wed, 2003-10-01 at 11:34, Gary Stainburn wrote:
> > In postgresql.conf:
> >
> > DATESTYLE = 'Postgres,European'

> When I did this, and then did 'service postgresql restart' the service failed
> to start.

> BTW, I'm running 7.2.3 from the RH RPMS.

The feature is available in 7.3

In 7.2 I seem to remember you can set an environemntal variable
PGDATESTYLE when starting psql, and you may be able to use SET:

  SET DATESTYLE TO 'Postgres,European';

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                             http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "Yet if any man suffer as a Christian, let him not be
      ashamed; but let him glorify God on this behalf."
                                        I Peter 4:16