Re: [GENERAL] Intervals

2005-04-26 Thread Jake Stride
That is helpful, I have created a slightly different function that returns an interval in the format HH:MM not sure if it will help anyone or anyone has any suggestions to improve it: create function hours(interval) returns varchar as 'SELECT floor(extract(epoch from $1)/3600) || \':\' || (cast(ex

Re: [GENERAL] Intervals

2005-04-26 Thread Andrei Gaspar
I had the same problem and wrote a small function create function hours(timestamp without time zone, timestamp without time zone) RETURNS integer as $$select cast( (cast($2 as date) - cast($1 as date)) * 24 + extract(hour from cast($2 as time) - cast($1 as time)) as integer)$$ language SQL IMMUT

Re: [GENERAL] Intervals

2005-04-26 Thread Dawid Kuroczko
On 4/26/05, Jake Stride <[EMAIL PROTECTED]> wrote: > Is there a way to convert in interval into hours? I have a table that > records the amount of time worked by a person and want to sum up all the > hours, however with the column being an interval once you reach more > than 24 hours it turns that

Re: [GENERAL] Intervals

2005-04-26 Thread Michael Glaesemann
On Apr 26, 2005, at 18:47, Jake Stride wrote: Is there a way to convert in interval into hours? I have a table that records the amount of time worked by a person and want to sum up all the hours, however with the column being an interval once you reach more than 24 hours it turns that into a day.

[GENERAL] Intervals

2005-04-26 Thread Jake Stride
Is there a way to convert in interval into hours? I have a table that records the amount of time worked by a person and want to sum up all the hours, however with the column being an interval once you reach more than 24 hours it turns that into a day. This is not what I want so instead of outputtin