Re: How to return an INT4 subtracting dates?

Поиск
Список
Период
Сортировка
От Raymond O'Donnell
Тема Re: How to return an INT4 subtracting dates?
Дата
Msg-id 4C0F7690.2000704@iol.ie
обсуждение исходный текст
Ответ на How to return an INT4 subtracting dates?  (Andre Lopes <lopes80andre@gmail.com>)
Список pgsql-general
On 09/06/2010 11:57, Andre Lopes wrote:
> Hi,
>
> I need to return an int4 subtracting two dates, but returns me an interval.
>
> select
> end_date - now() as interger_number
> from hist_anuncios
>
> How to return an integer out of this?

Hmmm, according to the docs, subtracting dates returns an integer:

  http://www.postgresql.org/docs/8.4/static/functions-datetime.html

Try "current_date", which gives you a date, instead of "now", which
gives you a timestamp.

Ray.


--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie

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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: How to return an INT4 subtracting dates?
Следующее
От: "Massa, Harald Armin"
Дата:
Сообщение: Windows: Compiling and linking dynamically-loaded functions