Learn the skill of code factoring...
lcd.setCursor(5, 3);
if ((now.hour() >= 10) && (now.hour() < 17))
{
lcd.print("Open window");
}
else
{
lcd.print("Closed window");
}
delay(30);
All I did was look for repetition and redundant tests.