Here is an alternative which is probably a lot faster because no text 
operations are involved, just math:

(RDATE(   INT(MOD(StartDate,10000)/100),   MOD(StartDate,100),   
INT(StartDate/10000)))

Dennis McGrath

________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of 
[email protected]
Sent: Tuesday, April 21, 2009 1:49 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: Numeric date type


Thanks Dennis and Emmitt,



 RDATE works as expected.

-Bob


----- Original Message -----
From: "Dennis McGrath" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Tuesday, April 21, 2009 9:18:32 AM GMT -06:00 US/Canada Central
Subject: [RBASE-L] - RE: Numeric date type

RDATE is the answer, it takes there intregers M,D,YYYY

RDATE(INT(SGET(CTXT(StartDate),2,5))),INT(SGET(CTXT(StartDate),2,7))),INT(SGET(CTXT(StartDate),4,1))))

Dennis McGrath

________________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of 
[email protected]
Sent: Tuesday, April 21, 2009 8:57 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Numeric date type

I am importing a table from an external database.
It has dates recorded in numeric type columns such as 20090420

After importing the table I have added a column MO_Start data type of date.
I want to update the values in this column to the date in the numeric field 
StartDate.
I tried....

Update TempMO set MO_Start = +
( (SGET((CTXT(StartDate)),2,5)) + '/' + +
  (SGET((CTXT(StartDate)),2,7)) + '/' + +
  (SGET((CTXT(StartDate)),4,1)) )

This returns "Expression does not return a valid date"

One can set a Date column type to a text variable, I.E.

set var vTxtDate Text = '04/20/2009'

Update TempMO set MO_Start = .vTxtDate

This works without error.

However, the UPDATE command does not like the
expression evidently.

I need to update the TempMO table's MO_Start date to
the date listed in the numeric column.  (I have to do a lot of
calculations on the dates and it is MUCH easier if in a date format)

Any thoughts on an UPDATE command to accomplish this?

Thanks,
-Bob


Reply via email to