Re: Convert interval to hours
От | Ron |
---|---|
Тема | Re: Convert interval to hours |
Дата | |
Msg-id | 784823d5-c1f8-590f-946e-f0040ac64278@gmail.com обсуждение исходный текст |
Ответ на | Re: Convert interval to hours (Steven Lembark <lembark@wrkhors.com>) |
Список | pgsql-general |
On 09/14/2018 11:10 AM, Steven Lembark wrote: > On Fri, 14 Sep 2018 11:55:18 -0400 > Peter Kleiner <runtfan71@gmail.com> wrote: >> On Fri, Sep 14, 2018 at 11:51 AM David Gauthier >> <davegauthierpg@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) ? > Suggest using one of the date modules. One issue is that not all > days are 86400s long: "leap second" is used to keep atomic clocks > in sync with siderial time so that telescopes report consistent > values over time. Catch is that simply dividing by 3600 doesn't > always work if the times fall across the wrong days. Can you give us a hard example of when this won't work? select extract(epoch from '-17 days -08:29:35'::interval)/3600 as hours; hours ------------------- -416.493055555556 (1 row) -- Angular momentum makes the world go 'round.
В списке pgsql-general по дате отправления: