Re: [SQL] Re: Arithmetic operation on DATE

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: [SQL] Re: Arithmetic operation on DATE
Дата
Msg-id web-101885@davinci.ethosmedia.com
обсуждение исходный текст
Ответ на Re: Arithmetic operation on DATE  ("Jason Wong" <postgresql@gremlins.com.hk>)
Список pgsql-novice
Jason, Macky,

>    expires = CURRENT_TIMESTAMP + 10
>
> would be 10 days from now. Don't know about months though.

That's almost correct.  Try:

expires := current_timestamp + '10 days'::INTERVAL

For macky's question:

expires := current_timestamp + '6 months'::INTERVAL

I'll be posting a FAQ on data/time datatypes in PostgreSQL soon.

-Josh Berkus


______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology      josh@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco

Вложения

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

Предыдущее
От: "macky"
Дата:
Сообщение: Altering pg_conndefaults
Следующее
От: Joshua Franklin
Дата:
Сообщение: ...