Обсуждение: date subtraction

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

date subtraction

От
Ashok Agrawal
Дата:
I need to do date calculation similar to oracle in postgres.

like sysdate - creation_date of the record which returns no
of days in oracle which you can convert to hours or second
by multiplying by 60 or 3600.

How do i achieve this in postgres.

Thanks
Ashok




Re: date subtraction

От
Richard Huxton
Дата:
Ashok Agrawal wrote:
> I need to do date calculation similar to oracle in postgres.
> 
> like sysdate - creation_date of the record which returns no
> of days in oracle which you can convert to hours or second
> by multiplying by 60 or 3600.
> 
> How do i achieve this in postgres.

Umm,  SELECT CURRENT_DATE - creation_date FROM my_table;

--   Richard Huxton  Archonet Ltd