Re: time interval math - Mailing list pgsql-sql

From Tim Landscheidt
Subject Re: time interval math
Date
Msg-id m3d39oixkh.fsf@passepartout.tim-landscheidt.de
Whole thread Raw
In response to time interval math  ("Edward W. Rouse" <erouse@comsquared.com>)
List pgsql-sql
"Edward W. Rouse" <erouse@comsquared.com> wrote:

> Hehe, thanks, I played around and ended up with this:

> round(SUM(extract('epoch' from (time_out - time_in))))

> I will have to do the division outside of the query, but that's really a
> minor issue.

You can always use subqueries.

>              Knowing the total in seconds was the big roadblock. And
> converting back is easier (a / 3600 + ":" + a / 60 + ":" + a % 60)
> [...]

PostgreSQL has also:

| tim=# SELECT 3661::TEXT::INTERVAL;
|  interval
| ----------
|  01:01:01
| (1 Zeile)

| tim=#

Tim



pgsql-sql by date:

Previous
From: "Edward W. Rouse"
Date:
Subject: Re: time interval math
Next
From: Jasen Betts
Date:
Subject: Re: time interval math