Re: convert integer to interval ?

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: <pilsl(at)goldfisch(dot)at>
Cc: postgres mailinglist <pgsql-general(at)postgresql(dot)org>
Subject: Re: convert integer to interval ?
Date: 2003-02-08 19:44:10
Message-ID: 20030208114321.B75189-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 8 Feb 2003 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.

One way is to make an interval string and cast it (something like)
select current_timestamp + CAST(num || ' days' AS interval);

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Laird 2003-02-08 20:25:09 Postgres Windows ADO help needed
Previous Message Magnus Naeslund(f) 2003-02-08 19:13:34 Re: convert integer to interval ?