pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vivek Khera <khera@kcilink.com>
To: pgsql-sql@postgresql.org
Subject: Re: Dateadd
Date: 04 May 2001 10:20:02 -0400
Message-ID: <x78zkdgprh.fsf@yertle.kciLink.com> (raw)
References: <9cqdur$m1u$1@news.tht.net>

>>>>> "LP" == Ligia Pimentel <lmpimentel@yahoo.com> writes:

LP> I need to know if there is a sql function implemented in postgres
LP> that gives me a date plus any number of days, months or years (the
LP> traditional dateadd function) or how to do it in sql?

Here's what I use:

select CURRENT_DATE + '4 DAYS'::interval;

Just cast your "interval" from a string to an interval type, then add
it to your date value.

I doubt this is portable.  What "tradition" provides for a dateadd()
function?


-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.                Khera Communications, Inc.
Internet: khera@kciLink.com       Rockville, MD       +1-240-453-8497
AIM: vivekkhera Y!: vivek_khera   http://www.khera.org/~vivek/



view thread (8+ messages)  latest in thread

Message-ID: <x78zkdgprh.fsf@yertle.kciLink.com>
Permalink:  ../x78zkdgprh.fsf@yertle.kciLink.com/
Also on:    postgresql.org/message-id/x78zkdgprh.fsf@yertle.kciLink.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: khera@kcilink.com
  Subject: Re: Dateadd
  In-Reply-To: <x78zkdgprh.fsf@yertle.kciLink.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