Re: How to convert US date format to European date format ?

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: How to convert US date format to European date format ?
Дата
Msg-id 5165665F.3070505@gmail.com
обсуждение исходный текст
Ответ на How to convert US date format to European date format ?  (Condor <condor@stz-bg.com>)
Список pgsql-general
On 04/10/2013 06:03 AM, Condor wrote:
> Hello ppl,
>
> I have a database where the previous owner use US date format in date
> fields:
>
> 2009-02-18
>
> Is there a way how to convert the fields in European format 18-02-2009.
> I mean existing date in records. What's will be happened if I change format
> in postgresql.conf ?

The dates are stored as a non formatted value. What you are seeing is
the output formatting:

http://www.postgresql.org/docs/9.2/interactive/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT

In other words the data in the fields will not be converted.

If you want a European style formatting then you can set the
DateStyle='SQL,DMY':

test=> set datestyle='SQL,DMY';
SET
test=> SELECT now()::date;
     now
------------
  10/04/2013
(1 row)


This can be done as needed or by setting it in postgresql.conf

>
>
> Cheers,
> Hristo S.
>
>


--
Adrian Klaver
adrian.klaver@gmail.com


В списке pgsql-general по дате отправления:

Предыдущее
От: Thomas Kellerer
Дата:
Сообщение: Re: How to convert US date format to European date format ?
Следующее
От: JotaComm
Дата:
Сообщение: Re: how to find which tables required indexes in postgresql