pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Ashok.Agrawal@Sun.COM
Cc: pgsql-sql@postgresql.org
Subject: Re: date subtraction
Date: Mon, 21 Mar 2005 08:07:18 +0000
Message-ID: <423E80B6.808@archonet.com> (raw)
In-Reply-To: <4239CD55.305@Sun.COM>
References: <4239CD55.305@Sun.COM>

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



view thread (2+ messages)

Message-ID: <423E80B6.808@archonet.com>
Permalink:  ../423E80B6.808@archonet.com/
Also on:    postgresql.org/message-id/423E80B6.808@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, Ashok.Agrawal@Sun.COM
  Subject: Re: date subtraction
  In-Reply-To: <423E80B6.808@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox