Retrieving INTERVAL as float hours?

Started by Ken Causeyover 25 years ago2 messagesgeneral
Jump to latest
#1Ken Causey
ken@premiernet.net

This may be a stupid question, and feel free to RTFM me, but please
specify the manual/book as I can't seem to find this. I want
to retrieve an INTERVAL (the sum of INTERVALS actually) as a float
hour. In other words if I normally get an output like

@ 2 hours 30 minutes

I would like

2.5

Thanks in advance for all help.

Ken Causey

#2Alex Bolenok
abolen@chat.ru
In reply to: Ken Causey (#1)
Re: Retrieving INTERVAL as float hours?

----- Original Message -----
From: "Ken Causey" <ken@premiernet.net>
To: <pgsql-general@postgresql.org>
Sent: Wednesday, July 12, 2000 6:14 PM
Subject: [GENERAL] Retrieving INTERVAL as float hours?

This may be a stupid question, and feel free to RTFM me, but please
specify the manual/book as I can't seem to find this. I want
to retrieve an INTERVAL (the sum of INTERVALS actually) as a float
hour. In other words if I normally get an output like

@ 2 hours 30 minutes

I would like

2.5

Thanks in advance for all help.

Ken Causey

ikar=# SELECT DATE_PART('epoch', '2 hours 30 minutes'::interval) / 3600;
?column?
----------
2.5
(1 row)

Alex Bolenok