Re: time interval math

Поиск
Список
Период
Сортировка
От Tim Landscheidt
Тема Re: time interval math
Дата
Msg-id m3d39oixkh.fsf@passepartout.tim-landscheidt.de
обсуждение исходный текст
Ответ на time interval math  ("Edward W. Rouse" <erouse@comsquared.com>)
Список 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 по дате отправления:

Предыдущее
От: "Edward W. Rouse"
Дата:
Сообщение: Re: time interval math
Следующее
От: Jasen Betts
Дата:
Сообщение: Re: time interval math