Re: Converting time interval to double precision of time unit - Mailing list pgsql-general

From Mike Toews
Subject Re: Converting time interval to double precision of time unit
Date
Msg-id 22f0a52d1003301236y189f0ba2y46091f657eec4cb1@mail.gmail.com
Whole thread Raw
In response to Re: Converting time interval to double precision of time unit  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On 30 March 2010 11:55, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I think what Mike is actually looking for is
>
> SELECT extract(epoch from interval '3 days 2 hours 34 minutes');
>  date_part
> -----------
>    268440

Yet better, if I define 1 hour as 3600 seconds (this is only incorrect
if the interval spans over a leap second), then the fractional hours
are:

SELECT extract(epoch from interval '3 days 2 hours 34 minutes')/3600 as hours;

Thanks!

-Mike

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Converting time interval to double precision of time unit
Next
From: John Gage
Date:
Subject: Running Windows on a Mac partition