Re: convert integer to interval ? - Mailing list pgsql-general

From Stephan Szabo
Subject Re: convert integer to interval ?
Date
Msg-id 20030208114321.B75189-100000@megazone23.bigpanda.com
Whole thread Raw
In response to convert integer to interval ?  (pilsl@goldfisch.at)
List pgsql-general
On Sat, 8 Feb 2003 pilsl@goldfisch.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);


pgsql-general by date:

Previous
From: "Magnus Naeslund(f)"
Date:
Subject: Re: convert integer to interval ?
Next
From: Tom Lane
Date:
Subject: Re: convert integer to interval ?