interval in days

Поиск
Список
Период
Сортировка
Искать

interval in days

От:
Tomka Gergely <tomka@zeus.gau.hu>
Дата:
date_part('epoch', date_trunc('day', TIMESTAMP 'now') -
date_trunc('day', hiba.datum)) / (60*60*24)

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.

-- 
Tomka Gergely
"S most - vajon barbárok nélkül mi lesz velünk?
Ők mégiscsak megoldás voltak valahogy..."

Re: interval in days

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Tomka Gergely  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
FAQ