| 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: | Pine.BSO.4.56.0412232300100.5322@leary.csoft.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| 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
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Xavier Poinsard | 2004-12-24 11:58:08 | Update french .po |
| Previous Message | Rakesh Shembekar | 2004-12-24 03:37:00 | interval related problem |