Skip site navigation (1) Skip section navigation (2)

Re: interval related problem

From: Kris Jurka <books(at)ejurka(dot)com>
To: Rakesh Shembekar <srakesh_22(at)yahoo(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: interval related problem
Date: 2004-12-24 04:06:06
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc

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(at)postgresql(dot)org 

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 

Kris Jurka

In response to

pgsql-jdbc by date

Next:From: Xavier PoinsardDate: 2004-12-24 11:58:08
Subject: Update french .po
Previous:From: Rakesh ShembekarDate: 2004-12-24 03:37:00
Subject: interval related problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group