Re: Time functions

Поиск
Список
Период
Сортировка
От Steve Crawford
Тема Re: Time functions
Дата
Msg-id 20021210172344.E00E1103C2@polaris.pinpointresearch.com
обсуждение исходный текст
Ответ на Time functions  ("Ron St.Pierre" <rstpierre@syscor.com>)
Список pgsql-general
How about:

select userID,
sum((abstime(endTimeStamp)-abstime(startTimeStamp))::numeric)/3600 as
totalhours from yourLogTable group by userID;

Cheers,
Steve

On Monday 09 December 2002 4:00 pm, Ron St.Pierre wrote:
> Hi, I've got another question about time - timestamps. I need to
> summarize the amount of time a user has used the system for from a table
> listing the userID, startTimestamp, endTimestamp.
>  id    userID     startTimestamp          endTimestamp
> 1     2119     5/10/00 7:32:33 PM     5/10/00 7:33:59 PM
> 2     2119     5/10/00 7:36:30 PM     5/10/00 7:39:27 PM
> 3     2119     5/10/00 7:40:01 PM     5/10/00 9:40:05 PM
> 4     2120     5/10/00 8:11:12 PM     5/10/00 8:11:21 PM
> 5     2121     5/10/00 8:12:26 PM     5/10/00 8:12:46 PM
>
> I don't want to use the interval functions as I don't want the results
> summarized by total months, weeks, days, years, hours, minutes,
> seconds...., I just want the total hours eg 47.98 HOURS
> I couldn't find any suitable way of doing it in the manual or in
> techdocs(.postgresq.org).
>
> Anyone have any suggestions?
> Thanks

В списке pgsql-general по дате отправления:

Предыдущее
От: Jim Martinez
Дата:
Сообщение: createlang plpgsql error
Следующее
От: "James F"
Дата:
Сообщение: Re: Referencing columns of the fly in triggers