Re: Time difference without intervals - Mailing list pgsql-sql

From Bruno Wolff III
Subject Re: Time difference without intervals
Date
Msg-id 20021108185910.GA7364@wolff.to
Whole thread Raw
In response to Time difference without intervals  (Roberto Mello <rmello@cc.usu.edu>)
List pgsql-sql
On Fri, Nov 08, 2002 at 11:20:02 -0700, Roberto Mello <rmello@cc.usu.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.


pgsql-sql by date:

Previous
From: Roberto Mello
Date:
Subject: Time difference without intervals
Next
From: Robert Treat
Date:
Subject: Re: changing numeric into int