Re: subtratcing dates

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: subtratcing dates
Дата
Msg-id 3811.989029158@sss.pgh.pa.us
обсуждение исходный текст
Ответ на subtratcing dates  (Fran Fabrizio <ffabrizio@exchange.webmd.net>)
Список pgsql-general
Fran Fabrizio <ffabrizio@exchange.webmd.net> writes:
> I want to have a query that tells me whether or not the timestamp is
> within 'limit' minutes of the current time.

A poorly documented fact is that you can coerce an integer number of
seconds into a reltime, which can then be added to or subtracted from
a timestamp.  So:

    select tstamp > now() - reltime(limit*60) from ...

should do it.

            regards, tom lane

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

Предыдущее
От: Justin Clift
Дата:
Сообщение: Re: Daylight savings
Следующее
От: Doug McNaught
Дата:
Сообщение: Re: Data conversion question