Re: How to convert US date format to European date format ? - Mailing list pgsql-general

From Adrian Klaver
Subject Re: How to convert US date format to European date format ?
Date
Msg-id 5165665F.3070505@gmail.com
Whole thread Raw
In response to How to convert US date format to European date format ?  (Condor <condor@stz-bg.com>)
List 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 by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: How to convert US date format to European date format ?
Next
From: JotaComm
Date:
Subject: Re: how to find which tables required indexes in postgresql