Search Postgresql Archives

Re: xml queries & date format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2008/9/11 Jef Peeraer <jef.peeraer@xxxxxxxxxx>:
>
>
> On Thu, 11 Sep 2008, Peter Eisentraut wrote:
>
>> Tom Lane wrote:
>> > Jef Peeraer <jef.peeraer@xxxxxxxxxx> writes:
>> > > i am using the xml add-ons, but the date output format seems to be wrong :
>> >
>> > I think the conversion to xml intentionally always uses ISO date format,
>> > because that's required by some spec somewhere.
>>
>> Yes, it follows XML Schema.  Which is why the output format is even slightly
>> different from the SQL-mandated ISO format.
> i understand, but that makes it very difficult to change the date format
> afterwards. i simple flag to indicate no date conversion would be
> helpfull....
>  >

no, use explicit casting to varchar

-- xml formating style
postgres=# select xmlforest(current_timestamp as date);
                   xmlforest
-----------------------------------------------
 <date>2008-09-11T12:21:44.600512+02:00</date>
(1 row)

postgres=# select xmlforest(current_timestamp::text as date);
                 xmlforest
--------------------------------------------
 <date>2008-09-11 12:22:25.180611+02</date>
(1 row)

postgres=# set datestyle to German ;
SET
postgres=# select xmlforest(current_timestamp::text as date);
                  xmlforest
----------------------------------------------
 <date>11.09.2008 12:22:32.947672 CEST</date>
(1 row)

regards
Pavel Stehule

>>
>> --
>> Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-general
>>
>>
>>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux