Re: convert integer to interval ?

From: "Magnus Naeslund(f)" <mag(at)fbab(dot)net>
To: <pilsl(at)goldfisch(dot)at>, "postgres mailinglist" <pgsql-general(at)postgresql(dot)org>
Subject: Re: convert integer to interval ?
Date: 2003-02-08 19:13:34
Message-ID: 004d01c2cfa6$2d71d1f0$f80c0a0a@mnd
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

pilsl(at)goldfisch(dot)at wrote:
> Sorry, I dont get familar with timefunctions in 7.3.2. I just
> upgraded and I need a function that adds a given interval in days to a
> given timestamp.
>
> something like
> select current_timestamp+interval '7 days';
>
> in my table the 7 is given as integer. And I dont get the conversion
> from this integer to interval where the integernumber is in days.

Is there any reason why you can't do:

sprintf(buf,"select current_timestamp+interval '%d days'",int_days);

Magnus

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2003-02-08 19:44:10 Re: convert integer to interval ?
Previous Message pilsl 2003-02-08 19:00:31 convert integer to interval ?