Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.4) with SMTP id f7EGYUP76622 for ; Tue, 14 Aug 2001 12:34:30 -0400 (EDT) (envelope-from pgsql-novice-owner@postgresql.org) Received: from ara.zf.jcu.cz (ara.zf.jcu.cz [160.217.161.4]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f7DABGP91375; Mon, 13 Aug 2001 06:11:16 -0400 (EDT) (envelope-from zakkr@zf.jcu.cz) Received: from ara.zf.jcu.cz (zakkr@localhost [127.0.0.1]) by localhost (8.12.0.Beta12/8.12.0.Beta12/Debian 8.12.0.Beta12) with ESMTP id f7DABDhH001699 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Mon, 13 Aug 2001 12:11:14 +0200 Received: (from zakkr@localhost) by ara.zf.jcu.cz (8.12.0.Beta12/8.12.0.Beta12/Debian 8.12.0.Beta12) id f7DABDix001698; Mon, 13 Aug 2001 12:11:13 +0200 Date: Mon, 13 Aug 2001 12:11:13 +0200 From: Karel Zak To: macky Cc: pgsql-novice@postgresql.org, pgsql-sql@postgresql.org Subject: Re: [SQL] Arithmetic operation on DATE Message-ID: <20010813121113.A1336@zf.jcu.cz> References: <001401c123dd$2c383430$5764a8c0@edsamail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <001401c123dd$2c383430$5764a8c0@edsamail.com>; from macky@edsamail.com on Mon, Aug 13, 2001 at 05:48:57PM +0800 X-Archive-Number: 200108/60 X-Sequence-Number: 1868 On Mon, Aug 13, 2001 at 05:48:57PM +0800, macky wrote: > is it possible to add a date datatype column to a number resulting to a > date...... > > > theoretically it should do this,,, > > X is in months > > date + X = date > > --> 2001-08-20 + 6 = 2002-02-20 test=# select '2001-08-20'::date + '6months'::interval; ?column? ------------------------ 2002-02-20 00:00:00+01 (1 row) ..see docs about the "interval" datetype. Karel -- Karel Zak http://home.zf.jcu.cz/~zakkr/ C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz