It doesn't help that you keep changing the times you're talking about.
I think what you mean is what you originally said: If the current time is from 10am up to but not including 5pm (17:00) show "Window open" or if it is not between those times show "Window closed". Is that right?
If so then surely all you need is something as simple as:
if ((hour >9) && (hour <17){
do the show "Window Open" stuff
}
else{
do the show "Window Closed" stuff
}
What am I missing?
Steve