Help separate characters
edwgeo
Posts: 8
In this program the varaible nDay obtains the value of the date of the current day. I need to separate the value obtained by the variable nDay ff the following way.
Integer nDay
nDay = DATE_TO_DAY (DATE) //example nDay =23
Day1 = MID_STRING (nDay, 1, 1) // example Day1 = 2
Day2 = MID_STRING (nDay, 2, 1) //example Day2 =3
I test with this code but it does not work, Please help me
Integer nDay
nDay = DATE_TO_DAY (DATE) //example nDay =23
Day1 = MID_STRING (nDay, 1, 1) // example Day1 = 2
Day2 = MID_STRING (nDay, 2, 1) //example Day2 =3
I test with this code but it does not work, Please help me
0
Comments
Try: Day1 = MID_STRING (itoa(nDay), 1, 1)
Also, do you want DAY1 to be the tens digit of the day?
You could use:
DAY1 = nDAY/10;
DAY2 = nDAY%10;
or
DAY1 = ITOA(nDAY/10);
DAY2 = ITOA(nDAY%10);
if you need strings
Jeff