pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Sabin Coanda <sabin.coanda@deuromedia.ro>
Cc: pgsql-sql@postgresql.org
Subject: Re: ISO time zone format
Date: Wed, 05 Sep 2007 15:32:53 +0100
Message-ID: <46DEBE15.3050201@archonet.com> (raw)
In-Reply-To: <fbm9pi$1hvu$1@news.hub.org>
References: <fbllup$10m8$1@news.hub.org>
	<46DE65E2.6090904@archonet.com>
	<fbm9pi$1hvu$1@news.hub.org>

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



view thread (6+ messages)  latest in thread

Message-ID: <46DEBE15.3050201@archonet.com>
Permalink:  ../46DEBE15.3050201@archonet.com/
Also on:    postgresql.org/message-id/46DEBE15.3050201@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, sabin.coanda@deuromedia.ro
  Subject: Re: ISO time zone format
  In-Reply-To: <46DEBE15.3050201@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox