From: Tom Lane <tgl@sss.pgh.pa.us>
To: Brian Knox <laotse@aol.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Convert INT to INTERVAL?
Date: Fri, 27 Feb 2004 13:12:17 -0500
Message-ID: <20773.1077905537@sss.pgh.pa.us> (raw)
In-Reply-To: <403F762B.20002@aol.net>
References: <403F762B.20002@aol.net>
Brian Knox <laotse@aol.net> writes:
> Is it possible within pl/pgsql, to convert an integer to an interval in
> months? IE, if num_months is an INT set to 48, can it be converted to an
> interval?
Sure, just multiply by the appropriate interval value:
regression=# select 48 * '1 month'::interval;
?column?
----------
4 years
(1 row)
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, laotse@aol.net
Subject: Re: Convert INT to INTERVAL?
In-Reply-To: <20773.1077905537@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox