Re: subtracting minutes from date

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: subtracting minutes from date
Дата
Msg-id 1140728912.18756.3.camel@state.g2switchworks.com
обсуждение исходный текст
Ответ на subtracting minutes from date  ("Brandon Metcalf" <bmetcalf@nortel.com>)
Ответы Re: subtracting minutes from date  ("Brandon Metcalf" <bmetcalf@nortel.com>)
Re: subtracting minutes from date  ("Jim C. Nasby" <jnasby@pervasive.com>)
Список pgsql-general
On Thu, 2006-02-23 at 13:55, Brandon Metcalf wrote:
> What is the best way to store a timestamp if all I need to do is
> select rows where this timestamp is less than 60 minutes prior to the
> current time?
>
> If I have a column called date with data type timestamp without time
> zone I know I can use
>
>   SELECT * FROM table WHERE date < (now()::DATE - 7)::TIMESTAMP;
>
> to select rows where date is older than seven days.  I'm not quite
> sure how to interpret now()::DATE::TIMESTAMP since I'm not able to
> answer my own question.  I've tried things like:
>
>   SELECT * FROM table WHERE date < now()::DATE::(TIMESTAMP - 60);

Tell it you're subracting a minute:

select now() - interval '13 minutes';

That kind of thing

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

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