Re: interval +variable

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Fatih Cerit <fatih(at)intersan(dot)com(dot)tr>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: interval +variable
Date: 2005-03-09 09:17:36
Message-ID: 20050309091736.GA29736@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Mar 09, 2005 at 10:58:05AM +0200, Fatih Cerit wrote:

> Is there anyone at there who knows howto use dateadd in pgsql. I have a
> problem in my function that is like this ;
>
> Select into futuredate now() + interval '30 days'; <- this is ok
> but how can I use a variable intead of '30 days' :(

Are you looking for something like this?

ndays := 30;
SELECT INTO futuredate now() + ndays * interval'1 day';

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Kenneth Gonsalves 2005-03-09 09:47:20 Re: datestyle setting
Previous Message Fatih Cerit 2005-03-09 08:58:05 interval +variable