Thread: date subtraction

date subtraction

From
Ashok Agrawal
Date:
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

From
Richard Huxton
Date:
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