The reason I am asking is because when I run the first method within an EEP, I 
am getting an error (Invalid data type)
Running the same code from an R> works fine.
Running the second method works fine, but as I recall, retyping variables is 
considered a less than ideal practice.
 
What I am actually doing is capturing the output of the DIR command from within 
Rbase, and then trying to extract the file name with it's date, and time and 
size from each line of the file created by the DIR command. All the data I 
capture is text that has to be converted.
 
Mike


________________________________
From: Javier Valencia <[email protected]>
To: RBASE-L Mailing List <[email protected]> 
Sent: Sunday, March 18, 2012 12:09 AM
Subject: [RBASE-L] - RE: Converting text to date or time


Mike,
 
Both methods will work but as Albert mentioned I would probably use the first 
one.
Since TEXT variables can hold any character or number, you need to have a way 
to check that you have a valid date, otherwise you will get a null result.
For example, values such as:
 
SET VAR vDate TEXT =’02/30/2012”
Or
SET VAR vDate TEXT = ‘13/12/2012’
 
will not convert correctly. Best practice is to collect data in its correct 
type and do the validity checking at data entry or data import time.
 
Javier,
 
Javier Valencia, PE
O: 913-829-0888
H: 913-397-9605
C: 913-915-3137
 
From:[email protected] [mailto:[email protected]] On Behalf Of Michael J. 
Sinclair
Sent: Saturday, March 17, 2012 8:35 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Converting text to date or time
 
Hi All,
I want to convert some text into a date or into a time
Is there a function that does that? 
If not, which is better...
 
SET VAR vdatetext TEXT
SET VAR vdatetext = '03/17/2012'
SET VAR vdate DATE
SET VAR vdate = .vdatetext
 
vs
 
SET VAR vdate TEXT = '03/17/2012'
SET VAR vdate DATE
 
vs
 
Something else?
 
Mike

Reply via email to