GetTime with S4
Comments
-
Hello,Is it not more simple to transform all in one variable in minute unit?nTime:=nHour*60+nMinute;IF (nTime > 24) AND (nTime < 408) THENTPWrite "1";ELSEIF (nTime >= 408) AND (nTime < 1002) THENTPWrite "2";ELSETPWrite "3";ENDIF
1 -
I think that is pretty smart Denis.Lee Justice0
-
Hi.
I suppose I should supplement with...
VAR num nTime;
0 -
Yes.
0 -
Your If statement is looping around.
IF (nHour >= 0) AND (nMinute > 24) AND (nHour = 6) AND (nMinute < 48) THEN
TPWrite "1"; ELSEIF (nHour > 6) AND (nMinute > 48) AND (nHour < 16) AND (nMinute < 42) THEN TPWrite "2"; ELSE TPWrite "3"; ENDIF
0 -
Hi.
Now its working with time (all in minutes).
Less is more... :-)
Now I (we) continues with date.
VAR string date;
VAR num nDate;
date := CDate();TPWrite "Current date is: "+date;That's OK
But when I have test IF... I got problem
Maybe is below?stDate:=StrPart(date,1,2);bOk:=StrToVal(stDate,nDate);
Any idea?0 -
What part of the date are you trying to examine?Lee Justice0
-
Oh.Is it possible to have both day and month in same?0
-
Look up both CDate and Strpart functions in manual.Lee Justice0
-
Hi.
"Look up both CDate and Strpart functions in manual."
I cant find it in the manual.I've also tested some, but the program pointer always stop on
ex.:stDate:=StrPart(date,1,2);stDate:=StrPart(date,2,2);stDate:=StrPart(date,3,2);stDate:=StrPart(date,4,2);stDate:=StrPart(date,8,2);0 -
burtlib666 said:Hi.
"Look up both CDate and Strpart functions in manual."
I cant find it in the manual.I've also tested some, but the program pointer always stop on
ex.:stDate:=StrPart(date,1,2);stDate:=StrPart(date,2,2);stDate:=StrPart(date,3,2);stDate:=StrPart(date,4,2);stDate:=StrPart(date,8,2);FUNC string sToday() VAR string sTextYear; VAR string sTextMonth; VAR string sTextDay; VAR string sTextHour; VAR string sTextMinute; VAR string sTextSecond; VAR num nTextHour; VAR num nTextMinute; VAR num nTextSecond; sReadDateToday:=CDate(); sReadTimeToday:=CTime(); sTextYear:=StrPart(sReadDateToday,1,4); sTextMonth:=StrPart(sReadDateToday,6,2); sTextDay:=StrPart(sReadDateToday,9,2); nTextHour:=GetTime(\Hour); nTextMinute:=GetTime(\Min); nTextSecond:=GetTime(\Sec); sTextHour:=NumToStr(nTextHour,0); sTextMinute:=NumToStr(nTextMinute,0); sTextSecond:=NumToStr(nTextSecond,0); RETURN "Today is "+sTextYear; !RETURN "Today is "+sTextYear+"/"+sTextMonth+"/"+sTextDay+sGap+"Time "+sTextHour+":"+sTextMinute+":"+sTextSecond; ENDFUNC
Have a look at this maybe this will give you some better understanding.0
Categories
- All Categories
- 5.5K RobotStudio
- 394 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings