Re: DATETIME in Select
Posted in 1996
Bhupendra Patel (bsqlbp@wnhealth.co.nz) wrote:
: adate char(6) yymmdd
: atime char(5) hh:mm
: select admno,
: adate[1,2]||"-"||adate[3,4]||"-"||adate[5,6]||" "||atime[1,5] adms ,
: current Year to minute bif
: from patmi1af
: where adate = "961012"
: INTO TEMP T1;
:
: select aurno, bif - datetime(adms)
: from t1
I am not aware of a datetime function, but here are two solutions which work
for me:
SELECT "19"||adate[1,2]||"-"||adate[3,4]||"-"||adate[5,6]||" "||atime adms
FROM patmi1af
INTO TEMP t1;
SELECT current - extend(adms, year to minute) FROM t1;
(Note that your year is only 2 digits, and a datetime requires a 4-digit
year, so I concatenated "19" to it.).)
or
CREATE TEMP TABLE t1 (adms DATETIME YEAR TO MINUTE);
INSERT INTO t1SELECT "19"||adate[1,2]||"-"||adate[3,4]||"-"||adate[5,6]||" "||atime
FROM patmi1af;
SELECT current - adms FROM t1;
June
---- June Tong Informix Software ----
---- Senior Consultant (415) 926-6140 ----
---- International Support junet@informix.com ----
---- Location-du-jour: Menlo Park ----
*
* Standard disclaimers apply
*
- Please do not send me requests/questions by mail. When I have the knowledge
- and time permits, I try to answer questions on comp.databases.informix, but
- travel schedule, time, and volume make responding to personal requests
- difficult and often slow. Please call your local Informix Technical Support
- organization for assistance with technical issues.