Re: subtracting minutes from date

Поиск
Список
Период
Сортировка
От Brandon Metcalf
Тема Re: subtracting minutes from date
Дата
Msg-id Pine.LNX.4.58L.0602231525380.30715@cash.rhiamet.com
обсуждение исходный текст
Ответ на Re: subtracting minutes from date  (Scott Marlowe <smarlowe@g2switchworks.com>)
Список pgsql-general
s == smarlowe@g2switchworks.com writes:

 s> On Thu, 2006-02-23 at 13:55, Brandon Metcalf wrote:
 s> > What is the best way to store a timestamp if all I need to do is
 s> > select rows where this timestamp is less than 60 minutes prior to the
 s> > current time?
 s> >
 s> > If I have a column called date with data type timestamp without time
 s> > zone I know I can use
 s> >
 s> >   SELECT * FROM table WHERE date < (now()::DATE - 7)::TIMESTAMP;
 s> >
 s> > to select rows where date is older than seven days.  I'm not quite
 s> > sure how to interpret now()::DATE::TIMESTAMP since I'm not able to
 s> > answer my own question.  I've tried things like:
 s> >
 s> >   SELECT * FROM table WHERE date < now()::DATE::(TIMESTAMP - 60);

 s> Tell it you're subracting a minute:

 s> select now() - interval '13 minutes';

Thanks.

--
Brandon

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

Предыдущее
От: "Brandon Metcalf"
Дата:
Сообщение: Re: subtracting minutes from date
Следующее
От: Emi Lu
Дата:
Сообщение: Re: SQL TYPE MAP such as SQL_CHAR, SQL_NUMERIC , etc