Re: How to return an INT4 subtracting dates?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Andre Lopes <lopes80andre(at)gmail(dot)com>
Cc: postgresql Forums <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to return an INT4 subtracting dates?
Date: 2010-06-09 11:02:46
Message-ID: AANLkTikcBAK-h-XDuShUKFoNm1JeFmGwzY_-ZHYq7XA4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

2010/6/9 Andre Lopes <lopes80andre(at)gmail(dot)com>:
> 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?
>
>
> Best Regards,
>
>

postgres=# select '2010-06-18'::date - CURRENT_DATE;
?column?
----------
9
(1 row)

Regards

pavel Stehule

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2010-06-09 11:10:08 Re: How to return an INT4 subtracting dates?
Previous Message Andre Lopes 2010-06-09 10:57:59 How to return an INT4 subtracting dates?