Re: INTERVAL is driving me crazy
Posted in 1999
In article <7u2bou$i6v$1@news2.inter.net.il>,
"David Henry" <henryd@net-gong.com> wrote:
> I'm trying to convert datetime values from one timezone to another,
however
> it
> seems that the value of INTERVAL can only be a constant.
> Any ideas how I can increment/decrement a DATETIME according to an INT
> variable that represents minutes?
>
Does the following do something like what you want? I used
the INTERVAL column just to prove that the math was correct.
It works in Informix 9.14 (I don't have an earlier version than that
here to try it with)
--------------------------------------------------
CREATE TABLE itest
(
c1 SERIAL,
c2 DATETIME YEAR TO SECOND,
c3 INTERVAL MINUTE(4) TO MINUTE,c4 INTEGER
);
INSERT INTO itest VALUES (0, CURRENT, INTERVAL (60) MINUTE(4) TO MINUTE,60);
INSERT INTO itest VALUES (0, CURRENT, INTERVAL (120) MINUTE(4) TO
MINUTE, 120);
INSERT INTO itest VALUES (0, CURRENT, INTERVAL (720) MINUTE(4) TO
MINUTE, 720);
INSERT INTO itest VALUES (0, CURRENT, INTERVAL (1440) MINUTE(4) TO
MINUTE, 1440);
SELECT * FROM itest;
SELECT c1, c2,
(c2 + c3), -- Use the INTERVAL column to add some minutes
(c2 + c4 UNITS MINUTE) -- Use the INT column to add someminutes
FROM itest;
--
--
The opinions expressed here are mine and only mine.
asalerno@my-deja.com
www.summitdata.com
Sent via Deja.com http://www.deja.com/
Before you buy.