pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
interval conversion
3+ messages / 2 participants
[nested] [flat]

* interval conversion
@ 2003-08-28 13:23 Brett Dikeman <brett@cloud9.net>
  2003-08-28 14:40 ` Re: interval conversion Tomasz Myrta <jasiek@klaster.net>
  0 siblings, 1 reply; 3+ messages in thread

From: Brett Dikeman @ 2003-08-28 13:23 UTC (permalink / raw)
  To: pgsql-sql

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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: interval conversion
  2003-08-28 13:23 interval conversion Brett Dikeman <brett@cloud9.net>
@ 2003-08-28 14:40 ` Tomasz Myrta <jasiek@klaster.net>
  2003-08-28 15:45   ` Re: interval conversion Brett Dikeman <brett@cloud9.net>
  0 siblings, 1 reply; 3+ messages in thread

From: Tomasz Myrta @ 2003-08-28 14:40 UTC (permalink / raw)
  To: brett@cloud9.net; +Cc: pgsql-sql

> 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




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: interval conversion
  2003-08-28 13:23 interval conversion Brett Dikeman <brett@cloud9.net>
  2003-08-28 14:40 ` Re: interval conversion Tomasz Myrta <jasiek@klaster.net>
@ 2003-08-28 15:45   ` Brett Dikeman <brett@cloud9.net>
  0 siblings, 0 replies; 3+ messages in thread

From: Brett Dikeman @ 2003-08-28 15:45 UTC (permalink / raw)
  To: Tomasz Myrta <jasiek@klaster.net>; +Cc: pgsql-sql


>> 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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2003-08-28 15:45 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-08-28 13:23 interval conversion Brett Dikeman <brett@cloud9.net>
2003-08-28 14:40 ` Tomasz Myrta <jasiek@klaster.net>
2003-08-28 15:45   ` Brett Dikeman <brett@cloud9.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox