pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Karel Zak <zakkr@zf.jcu.cz>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: Josh Berkus <josh@agliodbs.com>
Cc: Rajesh Kumar Mallah <mallah@trade-india.com>
Cc: Christoph Haller <ch@rodos.fzk.de>
Cc: pgsql-sql@postgresql.org
Cc: jasiek@klaster.net
Subject: Re: Formatting intervals..
Date: Fri, 21 Mar 2003 11:30:11 +0100
Message-ID: <20030321103010.GA7635@zf.jcu.cz> (raw)
In-Reply-To: <Pine.LNX.4.44.0303201925510.2112-100000@peter.localdomain>
References: <20030318074447.GG5283@zf.jcu.cz>
	<Pine.LNX.4.44.0303201925510.2112-100000@peter.localdomain>

On Fri, Mar 21, 2003 at 11:05:32AM +0100, Peter Eisentraut wrote:
> Karel Zak writes:
> 
> > test=# select to_char('3month 15d 4h 10m'::interval, 'DD-Mon HH24:MI:SS');
> >      to_char
> > -----------------
> >  15-Mar 04:10:00
> 
> This doesn't seem correct.  First, you can't make "March" out of "3
> months".  Second, 3 months, 15 days and some hours after the start of the
> year (if that definition were valid, which it isn't) is on March 16.

 The interval_to_char() calls interval2tm() and from 'tm' creates output like
 each other to_char() function.

 You can try to write better interval2tm() for fix it. I haven't time for this now.

> Third, why do you have to write "HH24"?  Surely no one would want to write
> out intervals using a 12-hour clock?

select to_char('5d 13h 10m 5s'::interval, 'HH or HH24:MI:SS');
    to_char     
----------------
 01 or 13:10:05
          
    Karel

-- 
 Karel Zak  <zakkr@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/



view thread (15+ messages)

Message-ID: <20030321103010.GA7635@zf.jcu.cz>
Permalink:  ../20030321103010.GA7635@zf.jcu.cz/
Also on:    postgresql.org/message-id/20030321103010.GA7635@zf.jcu.cz

 · 

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: zakkr@zf.jcu.cz, peter_e@gmx.net, josh@agliodbs.com, mallah@trade-india.com, ch@rodos.fzk.de, jasiek@klaster.net
  Subject: Re: Formatting intervals..
  In-Reply-To: <20030321103010.GA7635@zf.jcu.cz>

* 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