Re: Time difference without intervals

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Roberto Mello <rmello(at)cc(dot)usu(dot)edu>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Time difference without intervals
Date: 2002-11-08 18:59:10
Message-ID: 20021108185910.GA7364@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, Nov 08, 2002 at 11:20:02 -0700,
Roberto Mello <rmello(at)cc(dot)usu(dot)edu> wrote:
>
> Is there any way to make a timestamp difference operation not return an
> interval? I'd like to get hours, minutes and seconds only, not the "1 day"
> or whatnot.

When you take a difference of two timestamps, you are going to get an
interval that does not have a year, month difference component.

You can get the interval value in seconds by using
extract(epoch from interval).

You can then further manipulate this value to get hours, minutes and seconds.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Robert Treat 2002-11-08 19:12:57 Re: changing numeric into int
Previous Message Roberto Mello 2002-11-08 18:20:02 Time difference without intervals