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