pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedinterval related problem
2+ messages / 2 participants
[nested] [flat]
* interval related problem
@ 2004-12-24 03:37 Rakesh Shembekar <srakesh_22@yahoo.com>
2004-12-24 04:06 ` Re: interval related problem Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 2+ messages in thread
From: Rakesh Shembekar @ 2004-12-24 03:37 UTC (permalink / raw)
To: pgsql-jdbc
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
---------------------------------
Do you Yahoo!?
Meet the all-new My Yahoo! Try it today!
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: interval related problem
2004-12-24 03:37 interval related problem Rakesh Shembekar <srakesh_22@yahoo.com>
@ 2004-12-24 04:06 ` Kris Jurka <books@ejurka.com>
0 siblings, 0 replies; 2+ messages in thread
From: Kris Jurka @ 2004-12-24 04:06 UTC (permalink / raw)
To: Rakesh Shembekar <srakesh_22@yahoo.com>; +Cc: 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@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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2004-12-24 04:06 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-12-24 03:37 interval related problem Rakesh Shembekar <srakesh_22@yahoo.com>
2004-12-24 04:06 ` Kris Jurka <books@ejurka.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox