Why? Or, more specifically, why are they separated, and why aren't
they in DATETIME formats anyway?
Oh well, too late, no doubt.
> it doesnt seem to handle the time column, is there a trick to
> converting a CHAR to a DATETIME
Yes; think of it as an interval and not as a DATETIME.
DEFINE x DATE
DEFINE y CHAR(8)
DEFINE dt1 DATETIME YEAR TO DAY
DEFINE dt2 DATETIME YEAR TO SECOND
DEFINE dt3 DATETIME HOUR TO SECOND
LET x = MDY(2,29,2000)
LET y = "23:59:59"
LET dt1 = DATETIME(x) YEAR TO DAY
LET dt2 = EXTEND(dt1, YEAR TO SECOND) + INTERVAL(y) YEAR TO SECOND
Alternatively, if you must use DATETIME,
LET dt3 = DATETIME(y) HOUR TO SECOND
LET dt2 = EXTEND(dt1, YEAR TO SECOND) +
(dt3 - DATETIME(0) SECOND TO SECOND)
> i keep getting error -1262 Non-numeric character in datetime or
> interval
I haven't actually put the code above past a compiler, but it should
be correct.
--
Jonathan Leffler (jlef...@informix.com, jlef...@earthlink.net)
Guardian of DBD::Informix -- see http://www.perl.com/CPAN
#include <disclaimer.h>
i am using a cursor to select a date column, and a time column (char(8))
into variables and then want to combine these two variables into a single
datetime.
how ?
it doesnt seem to handle the time column, is there a trick to converting a
CHAR to a DATETIME
i keep getting error -1262 Non-numeric character in dtetime or interval
thanks
Darren Edgerton
darredge (darr...@bigpond.com) wrote:
: having trouble using datetime in 4GL ( 6.04.UC1 )
:
:
:
:
--
S.Oleshko
International Data Systems
s...@ids.lviv.ua
define
date_variable date,
char_variable char(8),
temp_char_variable char(19),
datetime_variable datetime year to second
select date_column, time_column into date_variable, char_variable
let temp_char_variable = date_variable using "yyyy-mm-dd", " ", char_variable
let datetime_variable = temp_char_var