pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
date subtraction
2+ messages / 2 participants
[nested] [flat]

* date subtraction
@ 2005-03-17 18:32 Ashok Agrawal <Ashok.Agrawal@Sun.COM>
  2005-03-21 08:07 ` Re: date subtraction Richard Huxton <dev@archonet.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Ashok Agrawal @ 2005-03-17 18:32 UTC (permalink / raw)
  To: pgsql-sql

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





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: date subtraction
  2005-03-17 18:32 date subtraction Ashok Agrawal <Ashok.Agrawal@Sun.COM>
@ 2005-03-21 08:07 ` Richard Huxton <dev@archonet.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Richard Huxton @ 2005-03-21 08:07 UTC (permalink / raw)
  To: Ashok.Agrawal@Sun.COM; +Cc: 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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-03-21 08:07 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-03-17 18:32 date subtraction Ashok Agrawal <Ashok.Agrawal@Sun.COM>
2005-03-21 08:07 ` Richard Huxton <dev@archonet.com>

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