i would like to trace the shift by the time format 12HR not 24HR format. i done this using 24HR but i want to change it to 12HR. The logic i made is this, i will trace either the time is AM or PM then create some condition. some time it gives me a corrent output but others not.
this is the piece of my code:
NOTE: CurrentHour is a variable where i get the 2 digit hour and the AMPM is the format of the time wheather it is AM or PM and the Description is a variable where i where the description wheather is is 1st, 2nd, or 3rd shift. in Automation they called it Tag.
Expand|Select|Wrap|Line Numbers
- IF (CurrentHour >= "06" AND AMPM == "AM") AND
- ((CurrentHour >= "12" AND AMPM == "PM") AND
- (CurrentHour <= "02" AND AMPM == "PM"))THEN
- Description = "1st Shift";
- ELSE
- IF (CurrentHour >= "03" AND AMPM == "PM") AND
- (CurrentHour <="10" AND AMPM == "PM") THEN
- Description = "2nd Shift";
- ELSE
- IF (CurrentHour >= "10" AND AMPM == "PM") AND
- (CurrentHour == "12" AND AMPM == "AM") THEN
- Description = "3rd Shift";
- ELSE
- Description = "3rd Shift";
- ENDIF;
- ENDIF;
- ENDIF;
Thank You