pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedCalculating with the time
2+ messages / 2 participants
[nested] [flat]
* Calculating with the time
@ 2003-05-30 18:04 Katka a Daniel Dunajsky <daniel_katka@hotmail.com>
2003-05-30 21:13 ` Re: Calculating with the time Guy Fraser <guy@incentre.net>
0 siblings, 1 reply; 2+ messages in thread
From: Katka a Daniel Dunajsky @ 2003-05-30 18:04 UTC (permalink / raw)
To: pgsql-sql
Hello All,
I am looking for an advice how to do calculation with the time. I do have a
column with datatype 'timestamp with time zone'. The value is '2003-03-22
07:53:56-07' for instance. I would like to select it from the table with
result of '07:59:59' '07:53:56', so the query should return '00:06:03'.
Thank you for your time.
DanielD
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Calculating with the time
2003-05-30 18:04 Calculating with the time Katka a Daniel Dunajsky <daniel_katka@hotmail.com>
@ 2003-05-30 21:13 ` Guy Fraser <guy@incentre.net>
0 siblings, 0 replies; 2+ messages in thread
From: Guy Fraser @ 2003-05-30 21:13 UTC (permalink / raw)
To: pgsql-sql
Is this what you are looking for?
test=# select 'now'::time as test,'2003-05-30 14:51:38-06'::timestamptz
as stamp into temp cruft;
SELECT
test=# select test,stamp,test - stamp::time as diff from cruft;
test | stamp | diff
-----------------+------------------------+-----------------
15:09:28.862728 | 2003-05-30 14:51:38-06 | 00:17:50.862728
(1 row)
test=# select test,stamp,reltime(test - stamp::time) as diff from cruft;
test | stamp | diff
-----------------+------------------------+----------
15:09:28.862728 | 2003-05-30 14:51:38-06 | 00:17:50
(1 row)
test=# drop table cruft;
DROP TABLE
Guy
Katka a Daniel Dunajsky wrote:
> Hello All,
>
> I am looking for an advice how to do calculation with the time. I do
> have a column with datatype 'timestamp with time zone'. The value is
> '2003-03-22 07:53:56-07' for instance. I would like to select it from
> the table with result of '07:59:59' – '07:53:56', so the query should
> return '00:06:03'.
>
> Thank you for your time.
>
> DanielD
>
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2003-05-30 21:13 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-05-30 18:04 Calculating with the time Katka a Daniel Dunajsky <daniel_katka@hotmail.com>
2003-05-30 21:13 ` Guy Fraser <guy@incentre.net>
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