Re: interval in days - Mailing list pgsql-novice

From Tom Lane
Subject Re: interval in days
Date
Msg-id 15838.1061822736@sss.pgh.pa.us
Whole thread Raw
In response to interval in days  (Tomka Gergely <tomka@zeus.gau.hu>)
List pgsql-novice
Tomka Gergely <tomka@zeus.gau.hu> writes:
> I hope there are a simple solution for this - i want to know the age of
> hiba.datum, in days. If one year old, then i need 365.

Cast both to type "date" and subtract.

regression=# select current_date - ('1999-08-25'::date);
 ?column?
----------
     1461
(1 row)


            regards, tom lane

pgsql-novice by date:

Previous
From: Tomka Gergely
Date:
Subject: interval in days
Next
From: "Louise Cofield"
Date:
Subject: Number of rows in a table