On Fri, Sep 14, 2018 at 11:51 AM David Gauthier
<davegauthie...@gmail.com> wrote:
>
> Hi:
>
> In perl/DBI, I have code that's getting me an "age" which returns something 
> like... "-17 days -08:29:35".  How can I convert that to a number of hours 
> (as a float I would presume) ?
>
> Thanks
>
>
>
>

I've done this as
select extract(epoch from '-17 days -08:29:35'::interval)/3600 as hours;

hours
-------------------
 -416.493055555556
(1 row)

Others might have a better way, though.

Pete

Reply via email to