Обсуждение: Datetypes

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

Datetypes

От
"Strand Johan F."
Дата:
Hello there !

How do I do if I want to change the variable
DATETYPES or PGDATESTYLE to ISO.
I want to se my date column like this 2000-01-12
and not 01-12-2000 when I do a select on it.

Thanks

/Johan
johan.f.strand@telia.se

Re: [ADMIN] Datetypes

От
Mattias Norlander
Дата:
I use this to start up my postmaster:

su - postgres -c 'export PGDATESTYLE=ISO; postmaster -N 32 -B 256 -i -o "-S 16535 -F" 2>>/var/log/pglog
>>/var/log/pglog'>>/dev/null& 

... which sets the datestyle to ISO.

There is also a sql command called "SET DATESTYLE" but I can't get it to work though...

"Strand Johan F." <johan.f.strand@telia.se> writes:

> Hello there !
>
> How do I do if I want to change the variable
> DATETYPES or PGDATESTYLE to ISO.
> I want to se my date column like this 2000-01-12
> and not 01-12-2000 when I do a select on it.
>
> Thanks
>
> /Johan
> johan.f.strand@telia.se
>
> ************
>
>
>

--
Mattias Norlander
mattias@umc.se

Re: [ADMIN] Datetypes

От
Mattias Norlander
Дата:
"SET DATESTYLE TO 'ISO'; SELECT yaddayaddayadda... "

...should work as well.

"Strand Johan F." <johan.f.strand@telia.se> writes:

> Hello there !
>
> How do I do if I want to change the variable
> DATETYPES or PGDATESTYLE to ISO.
> I want to se my date column like this 2000-01-12
> and not 01-12-2000 when I do a select on it.
>
> Thanks
>
> /Johan
> johan.f.strand@telia.se
>
> ************
>
>
>

--
Mattias Norlander
mattias@umc.se

Re: [ADMIN] Datetypes

От
Bruce Momjian
Дата:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Hello there !
>
> How do I do if I want to change the variable
> DATETYPES or PGDATESTYLE to ISO.
> I want to se my date column like this 2000-01-12
> and not 01-12-2000 when I do a select on it.

SET DATESTYLE TO 'ISO'  should do it.  See my book for a section on date
styles in the web documentation page.

--
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026