Re: ISO time zone format

From: Richard Huxton <dev(at)archonet(dot)com>
To: Sabin Coanda <sabin(dot)coanda(at)deuromedia(dot)ro>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: ISO time zone format
Date: 2007-09-05 14:32:53
Message-ID: 46DEBE15.3050201@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Joel Fradkin 2007-09-05 14:47:29 recursive query
Previous Message Sabin Coanda 2007-09-05 13:09:15 Re: ISO time zone format