Обсуждение: interval conversion

Поиск
Список
Период
Сортировка

interval conversion

От
"Brett Dikeman"
Дата:
Hello all!

I have a possibly stupid question- I'm doing some time calculations yielding
intervals, and for my purposes I need to convert the interval(say, "1 day 8
hours") into (floating point) hours.  While there's a plethora of handy
date_extract functionality and the like, I need a conversion.

Any suggestions on how to accompish this?  Simpler the better, of course.

Thanks!

Brett


Re: interval conversion

От
Tomasz Myrta
Дата:
> Hello all!
> 
> I have a possibly stupid question- I'm doing some time calculations yielding
> intervals, and for my purposes I need to convert the interval(say, "1 day 8
> hours") into (floating point) hours.  While there's a plethora of handy
> date_extract functionality and the like, I need a conversion.
> 
> Any suggestions on how to accompish this?  Simpler the better, of course.

extract(epoch from some_interval)/3600

Regards,
Tomasz Myrta



Re: interval conversion

От
"Brett Dikeman"
Дата:
>> I have a possibly stupid question- I'm doing some time calculations yielding
>> intervals, and for my purposes I need to convert the interval(say, "1 day 8
>> hours") into (floating point) hours.  While there's a plethora of handy
>> date_extract functionality and the like, I need a conversion.
>>
>> Any suggestions on how to accompish this?  Simpler the better, of course.
>
> extract(epoch from some_interval)/3600

[slaps head] I swear, I studied the date/time sections of the manual for quite
some time...really...Siiiigh :-)

Thanks Tomasz!

Brett