I have a date field (4/8/2010 M/D/YYYY) that is in a string. I need to converet it into a date field. I have tried the following:
StringVar DT := {Prt.Prt_Registration_Date};
NumberVar YR := Val (Split (DT , '/')[3]);
if YR < 50 then YR := YR + 2000 else
if YR < 1000 then YR := YR + 1900;
Date ( YR,
Val (Split (DT , '/') [1]),
Val (Split (DT , '/') [2]) )
I get the following error message:
A subscript must be between 1 & the size of the array.
What is wrong with my formula? Or what formula could I use to get this into a date?
StringVar DT := {Prt.Prt_Registration_Date};
NumberVar YR := Val (Split (DT , '/')[3]);
if YR < 50 then YR := YR + 2000 else
if YR < 1000 then YR := YR + 1900;
Date ( YR,
Val (Split (DT , '/') [1]),
Val (Split (DT , '/') [2]) )
I get the following error message:
A subscript must be between 1 & the size of the array.
What is wrong with my formula? Or what formula could I use to get this into a date?