Re: date subtraction

From: Richard Huxton <dev(at)archonet(dot)com>
To: Ashok(dot)Agrawal(at)Sun(dot)COM
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: date subtraction
Date: 2005-03-21 08:07:18
Message-ID: 423E80B6.808@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Mihail Nasedkin 2005-03-21 08:26:21 index scan
Previous Message Richard Huxton 2005-03-21 08:02:05 Re: Trigger with parameters