Обсуждение: non-us datestyle

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

non-us datestyle

От
Cedar Cox
Дата:
Is there a way to set the default date style to non-US (European)?  I
didn't see any compile or run time options, just per connection options.
(pg v1.7)

-Cedar



RE: non-us datestyle

От
"Oscar Serrano"
Дата:

> -----Mensaje original-----
> De: pgsql-interfaces-owner@postgresql.org
> [mailto:pgsql-interfaces-owner@postgresql.org]En nombre de Cedar Cox
> Enviado el: miercoles, 04 de julio de 2001 14:53
> Para: pgsql-interfaces@postgresql.org
> Asunto: [INTERFACES] non-us datestyle
>
>
>
> Is there a way to set the default date style to non-US (European)?  I
> didn't see any compile or run time options, just per connection options.
> (pg v1.7)
>
> -Cedar

Well I'm not sure if you are asking for this but...
If you define the shell variable PGDATESTYLE to, for example, SQL, all date
are returned like this:
dd/mm/yyyy
There are serveral values you can assign to PGDATESTYLE.
You can execute, prior to a query this sentence:
SET DATESTYLE TO SQL




>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>



RE: non-us datestyle

От
Cedar Cox
Дата:
On Wed, 4 Jul 2001, Oscar Serrano wrote:
> 
> > -----Mensaje original-----
> > De: pgsql-interfaces-owner@postgresql.org
> > [mailto:pgsql-interfaces-owner@postgresql.org]En nombre de Cedar Cox
> > Enviado el: miercoles, 04 de julio de 2001 14:53
> > Para: pgsql-interfaces@postgresql.org
> > Asunto: [INTERFACES] non-us datestyle
> >
> > Is there a way to set the default date style to non-US (European)?  I
> > didn't see any compile or run time options, just per connection options.
> > (pg v1.7)
> >
> > -Cedar
> 
> Well I'm not sure if you are asking for this but...
> If you define the shell variable PGDATESTYLE to, for example, SQL, all date
> are returned like this:
> dd/mm/yyyy
> There are serveral values you can assign to PGDATESTYLE.
> You can execute, prior to a query this sentence:
> SET DATESTYLE TO SQL

I'll be using ODBC so there's no shell variable to set...  This is why I
want a global option.

-Cedar



RE: non-us datestyle

От
"Oscar Serrano"
Дата:

> -----Mensaje original-----
> De: Cedar Cox [mailto:cedarc@visionforisrael.com]
> Enviado el: miercoles, 04 de julio de 2001 16:48
> Para: Oscar Serrano
> CC: pgsql-interfaces@postgresql.org
> Asunto: RE: [INTERFACES] non-us datestyle
> 
> 
> 
> On Wed, 4 Jul 2001, Oscar Serrano wrote:
> > 
> > > -----Mensaje original-----
> > > De: pgsql-interfaces-owner@postgresql.org
> > > [mailto:pgsql-interfaces-owner@postgresql.org]En nombre de Cedar Cox
> > > Enviado el: miercoles, 04 de julio de 2001 14:53
> > > Para: pgsql-interfaces@postgresql.org
> > > Asunto: [INTERFACES] non-us datestyle
> > >
> > > Is there a way to set the default date style to non-US (European)?  I
> > > didn't see any compile or run time options, just per 
> connection options.
> > > (pg v1.7)
> > >
> > > -Cedar
> > 
> > Well I'm not sure if you are asking for this but...
> > If you define the shell variable PGDATESTYLE to, for example, 
> SQL, all date
> > are returned like this:
> > dd/mm/yyyy
> > There are serveral values you can assign to PGDATESTYLE.
> > You can execute, prior to a query this sentence:
> > SET DATESTYLE TO SQL
> 
> I'll be using ODBC so there's no shell variable to set...  This is why I
> want a global option.

But, have you tried it?
Beacuse I use DBI from a windows machine with ActivePerl and it works.

Oscar Serrano.




> -Cedar
> 
> 


Re: non-us datestyle

От
Tom Lane
Дата:
Cedar Cox <cedarc@visionforisrael.com> writes:
> Is there a way to set the default date style to non-US (European)?

You can set PGDATESTYLE in the postmaster's environment, I think.

This should be a GUC variable (hence settable in postgresql.conf)
but isn't yet.
        regards, tom lane


RE: non-us datestyle

От
"Oscar Serrano"
Дата:

> -----Mensaje original-----
> De: pgsql-interfaces-owner@postgresql.org
> [mailto:pgsql-interfaces-owner@postgresql.org]En nombre de Tom Lane
> Enviado el: miércoles, 04 de julio de 2001 17:56
> Para: Cedar Cox
> CC: pgsql-interfaces@postgresql.org
> Asunto: Re: [INTERFACES] non-us datestyle
>
>
> Cedar Cox <cedarc@visionforisrael.com> writes:
> > Is there a way to set the default date style to non-US (European)?
>
> You can set PGDATESTYLE in the postmaster's environment, I think.
>
> This should be a GUC variable (hence settable in postgresql.conf)
> but isn't yet.


I've seen that we stat postmaster with this options:
postmaster -D /mypath -i -o '-e -S 32768' &
The -o options means the parameters we pass to every postgres child. so,
the -e option in the postgres executable means "European dates".

Oscar Serrano.



>             regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>



Re: non-us datestyle

От
Hiroshi Inoue
Дата:
Tom Lane wrote:
> 
> Cedar Cox <cedarc@visionforisrael.com> writes:
> > Is there a way to set the default date style to non-US (European)?
> 
> You can set PGDATESTYLE in the postmaster's environment, I think.
> 
> This should be a GUC variable (hence settable in postgresql.conf)
> but isn't yet.
> 

psqlodbc driver seems to set the DateStyle for itself in
interfaces/odbc/connection.c.
/* Set the Datestyle to the format the driver expects it to be in */result = SQLExecDirect(hstmt, "set DateStyle to
'ISO'",SQL_NTS);
 

regards,
Hiroshi Inoue


Re: non-us datestyle

От
Cedar Cox
Дата:
On Wed, 4 Jul 2001, Tom Lane wrote:

> Cedar Cox <cedarc@visionforisrael.com> writes:
> > Is there a way to set the default date style to non-US (European)?
>
> You can set PGDATESTYLE in the postmaster's environment, I think.
>
> This should be a GUC variable (hence settable in postgresql.conf)
> but isn't yet.
>
>             regards, tom lane

I assume this is in a todo or already done?

FYI, for what we need we actually don't need to set the datestyle.  If you
go through ODBC (Win/Access), it will take the system's regional settings
and use those (for display and input).  Anyway, thanks for the answers.

BTW, is there a header file or something simple to change to default
everything to European so we don't have to worry about postmaster options?

-Cedar


Re: non-us datestyle

От
Hannu Krosing
Дата:
Cedar Cox wrote:
> 
> On Wed, 4 Jul 2001, Oscar Serrano wrote:
> >
> > > -----Mensaje original-----
> > > De: pgsql-interfaces-owner@postgresql.org
> > > [mailto:pgsql-interfaces-owner@postgresql.org]En nombre de Cedar Cox
> > > Enviado el: miercoles, 04 de julio de 2001 14:53
> > > Para: pgsql-interfaces@postgresql.org
> > > Asunto: [INTERFACES] non-us datestyle
> > >
> > > Is there a way to set the default date style to non-US (European)?  I
> > > didn't see any compile or run time options, just per connection options.
> > > (pg v1.7)
> > >
> > > -Cedar
> >
> > Well I'm not sure if you are asking for this but...
> > If you define the shell variable PGDATESTYLE to, for example, SQL, all date
> > are returned like this:
> > dd/mm/yyyy
> > There are serveral values you can assign to PGDATESTYLE.
> > You can execute, prior to a query this sentence:
> > SET DATESTYLE TO SQL
> 
> I'll be using ODBC so there's no shell variable to set...  This is why I
> want a global option.


IIRC, ODBC driver allows you to specify a set of queries to run right
after connect.

You can put your SET DATESTYLE TO XXX; there

----------------
Hannu