hi everyone, i know this is easy to others but i'm going to explode now to this. the scenario is this. i would like to trace where the time is equivalent to 1st Shift, 2nd Shift and 3rd Shift where 1st Shift = 6AM - 2PM, 2nd Shift = 2PM - 10PM and the 3rd Shift = 10PM - 6AM..
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.
by the why the code above is what they code Wonderware a Automation Software but it seems like a VB syntax. Hope you can help me.
Thank You
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.
Code:
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
Comment