X-Original-To: pgsql-sql@postgresql.org Received: from ara.zf.jcu.cz (ara.zf.jcu.cz [160.217.161.4]) by postgresql.org (Postfix) with ESMTP id DD85B47611A for ; Fri, 21 Mar 2003 05:30:28 -0500 (EST) Received: from ara.zf.jcu.cz (LOCALHOST [127.0.0.1]) by ara.zf.jcu.cz (8.12.1/8.12.1/Debian -5) with ESMTP id h2LAUBpp020237; Fri, 21 Mar 2003 11:30:12 +0100 Received: (from zakkr@localhost) by ara.zf.jcu.cz (8.12.1/8.12.1/Debian -5) id h2LAUBQE020236; Fri, 21 Mar 2003 11:30:11 +0100 Date: Fri, 21 Mar 2003 11:30:11 +0100 From: Karel Zak To: Peter Eisentraut Cc: Josh Berkus , Rajesh Kumar Mallah , Christoph Haller , pgsql-sql@postgresql.org, jasiek@klaster.net Subject: Re: Formatting intervals.. Message-ID: <20030321103010.GA7635@zf.jcu.cz> References: <20030318074447.GG5283@zf.jcu.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.28i X-Archive-Number: 200303/491 X-Sequence-Number: 12530 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 http://home.zf.jcu.cz/~zakkr/