Re: Duration between two timestamps

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: phil campaigne <pcampaigne(at)charter(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Duration between two timestamps
Date: 2005-02-04 17:56:37
Message-ID: 20050204175633.GC14840@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Feb 04, 2005 at 10:37:52AM -0500, phil campaigne wrote:
>
> Hi All,
> I have stored event records in Postgresql 7.3.4 and now need to
> calculate the duration between each event in succession. I have
> "record_id" and a" timestamp without time zone" columns for each event.
>
> What is a good way to calculate the difference in timestamp and store it
> in the record as duration. I am doing this as part of a java
> application on RH linux 8.0.

Have you tried just subtracting them? That will give you a value of
type "interval" which you can then store...

Hope this helps,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Karl O. Pinc 2005-02-04 17:59:37 Re: Questions about functionality
Previous Message Rick Apichairuk 2005-02-04 17:55:39 Re: [ADMIN] vacuum ran out of space and now i cant get back into db