I think the conditional method is the most straight forward,
But you can use the modulo (mod) operator.
Modulo uses the remainder of a division as it's output.
Edit
Oh god, I realized something I overlooked when considering the modulo operation that makes this post pointless! If I hadn't prematurely posted this on accident I would have just canceled posting, alas I fat-fingered the screen and accidentally posted it before I intended to.
Well, guess I am comitting to this now.
You can use the mod operator to also do this. I still think the conditional way is probably the best and most straight forward but maybe you can apply this idea later.
So every in game hour, increment your day/night variable by 1.
Then do a conditional.
If day/night >= 27
Control variable: day/night %27 (the % represents modulo)
You could also do this with 2 variables: an hour variable that's constantly ticking up forever and ever and a time of day variable that you will mod using the value of the hour variable.
Anyways, because of my mistake this is all pretty pointless, so uh...I don't know. I hope you learned something today.
Mods are cool. The nuddy mods are my favorite.