X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D1BC73B5D90 for ; Fri, 24 Dec 2004 04:09:01 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83700-06 for ; Fri, 24 Dec 2004 04:08:51 +0000 (GMT) Received: from mail63.csoft.net (leary3.csoft.net [63.111.22.74]) by svr1.postgresql.org (Postfix) with SMTP id 52FAC3B5DA2 for ; Fri, 24 Dec 2004 04:04:23 +0000 (GMT) Received: (qmail 15576 invoked by uid 1112); 24 Dec 2004 04:06:07 -0000 Date: Thu, 23 Dec 2004 23:06:06 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Rakesh Shembekar Cc: pgsql-jdbc@postgresql.org Subject: Re: interval related problem In-Reply-To: <20041224033700.94987.qmail@web14307.mail.yahoo.com> Message-ID: References: <20041224033700.94987.qmail@web14307.mail.yahoo.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200412/180 X-Sequence-Number: 11846 On Thu, 23 Dec 2004, Rakesh Shembekar wrote: > I am firing a query some thing like this select ('2004-12-12'::time - > '2004-10-12'::time) from employee; Which returs me time in days I want > time in hours and minutes what I should do With anticipatory thanks > This question has nothing to do with Java or JDBC so it is not really appropriate for this list. I suggest you try pgsql-general@postgresql.org instead. Your example clearly isn't right because: =# select ('2004-12-12'::time - '2004-10-12'::time); ERROR: invalid input syntax for type time: "2004-12-12" If you are really casting to a date then date subtraction does give an integer. If you are casting to a timestamp then subtraction gives you an interval. Conversion from either of these forms to hours and minutes will require some doing on your part. You might investigae the extract command: http://www.postgresql.org/docs/7.4/static/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT Kris Jurka