Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 8127C634DFD for ; Sun, 22 Mar 2009 01:14:56 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 61683-07-3 for ; Sun, 22 Mar 2009 01:14:47 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail.postgresql.org (Postfix) with ESMTP id 4790E633A8A for ; Sun, 22 Mar 2009 01:12:48 -0300 (ADT) Received: by leary.csoft.net (Postfix, from userid 1112) id E760CA1AA; Sun, 22 Mar 2009 00:12:46 -0400 (EDT) Date: Sun, 22 Mar 2009 00:12:46 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: "r.trommer@open-factory.org" cc: pgsql-jdbc@postgresql.org Subject: Re: Understanding PGInterval In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Archive-Number: 200903/109 X-Sequence-Number: 19439 On Sat, 21 Mar 2009, r.trommer@open-factory.org wrote: > i try to understand how i can use the PGInterval Object. I have to > solve a little issue in Java. I have created a SQL-statement which > give me a resultset like this: > > id | duration > 1 | 01:49:00 > 2 | 00:30:00 > > The datetypes id =3D int and duration =3D PGInterval. I would like to sum > the both duration values in Java. I can=B4t use a SQL sum because i need > the results later to report some details. > The 8.3 driver series has an enhancement to PGInterval which supports=20 adding them together. So you can do interval1.add(interval2) to sum=20 things up. What it doesn't support is justifying the results, so in the=20 example you've shown above the total would be 1 hour, 79 minutes rather=20 than 2 hours and 19 minutes. Kris Jurka=