Re: ISO time zone format - Mailing list pgsql-sql

From Richard Huxton
Subject Re: ISO time zone format
Date
Msg-id 46DEBE15.3050201@archonet.com
Whole thread Raw
In response to Re: ISO time zone format  ("Sabin Coanda" <sabin.coanda@deuromedia.ro>)
List pgsql-sql
Sabin Coanda wrote:
> 
> I'd just like to format it independent of my DateStyle. Some timestamp parts 
> may be formatted this way.
> 
> For instance I can format ISO date with to_char( dt, 'YYYY-MM-DD'), and ISO 
> time with to_char( dt, 'HH24:MI:SS') as well. I'd just like to find the 
> format pattern for the ISO time zone (numeric).

Hmm - we don't seem to support those codes (TZH, TZM) for some reason.

http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements004.htm#sthref405

But it seems the developers know about it:  http://www.postgresql.org/docs/faqs.TODO.html
http://archives.postgresql.org/pgsql-hackers/2005-12/msg00948.php

If you know a little bit of "C" then you should be able to submit a 
patch for this without too much trouble.


For the moment, you'll have to use extract() to pick out the bit(s) you 
need:  to_char(extract(timezone_hour from current_timestamp), 'S00');


HTH
--   Richard Huxton  Archonet Ltd


pgsql-sql by date:

Previous
From: "Sabin Coanda"
Date:
Subject: Re: ISO time zone format
Next
From: "Joel Fradkin"
Date:
Subject: recursive query