Re: interval in days

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tomka Gergely <tomka(at)zeus(dot)gau(dot)hu>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: interval in days
Date: 2003-08-25 14:45:36
Message-ID: 15838.1061822736@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Tomka Gergely <tomka(at)zeus(dot)gau(dot)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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Louise Cofield 2003-08-25 16:06:28 Number of rows in a table
Previous Message Tomka Gergely 2003-08-25 08:14:55 interval in days