ericfmyers
Technical User
I have number fields on the AS400 that I'm trying to combine into a DateTime value. The first field is the date and was able to create the date value using this formula:
stringvar x := totext({EXMP.DATE},0,"");
date(1900+val(left(x,3)),val(mid(x,4,2)),val(right(x,2)));
The second field is the time (hours:minutes:seconds note that the leading zeros are missing on some). A couple of examples in this field are:
94357
131409
120145
51255
164555
When I try to use the timevalue formula it's returning 12:00am for all times. I believe that using this formula doesn't work because of the missing leading zeros:
stringvar x := totext({EXMP.TIME},0,"");
timevalue(val(left(x,6)),val(mid(x,4,2)),val(right(x,2)));
Once those two formulas are working I was going to bundle them using DateTime. Am I going about this the wrong way? Or is there a better solution?
Thank you.
stringvar x := totext({EXMP.DATE},0,"");
date(1900+val(left(x,3)),val(mid(x,4,2)),val(right(x,2)));
The second field is the time (hours:minutes:seconds note that the leading zeros are missing on some). A couple of examples in this field are:
94357
131409
120145
51255
164555
When I try to use the timevalue formula it's returning 12:00am for all times. I believe that using this formula doesn't work because of the missing leading zeros:
stringvar x := totext({EXMP.TIME},0,"");
timevalue(val(left(x,6)),val(mid(x,4,2)),val(right(x,2)));
Once those two formulas are working I was going to bundle them using DateTime. Am I going about this the wrong way? Or is there a better solution?
Thank you.