pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
time calculations
2+ messages / 2 participants
[nested] [flat]

* time calculations
@ 2001-05-04 14:48 Oliver Vecernik <vecernik@aon.at>
  2001-05-04 15:26 ` Re: time calculations Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Oliver Vecernik @ 2001-05-04 14:48 UTC (permalink / raw)
  To: pgsql-admin

Hi,

I've got a table with two columns: one for distance in km (float4) and
one for the time (interval). I'd like to calculate the speed.

My problem is how to convert the intervals to decimal hours to be able
to a simple:

SELECT *, distance/time as speed from table;

Any clues? Are there any docs (maybe I have overseen something)?

Regards,
Oliver



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: time calculations
  2001-05-04 14:48 time calculations Oliver Vecernik <vecernik@aon.at>
@ 2001-05-04 15:26 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2001-05-04 15:26 UTC (permalink / raw)
  To: Oliver Vecernik <vecernik@aon.at>; +Cc: pgsql-admin

Oliver Vecernik <vecernik@aon.at> writes:
> My problem is how to convert the intervals to decimal hours

See date_part('epoch', interval_value)

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2001-05-04 15:26 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-05-04 14:48 time calculations Oliver Vecernik <vecernik@aon.at>
2001-05-04 15:26 ` Tom Lane <tgl@sss.pgh.pa.us>

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