Compare times

Jimmus:
You're getting very close. I think you could do it like this:

      if ((now.hour() >= 10) && (now.hour() < 17)) 

{
        lcd.setCursor(5, 3);
        lcd.print("Open window");
        delay(30);
      }
      else
      {
        lcd.setCursor(5, 3);
        lcd.print("Closed window");
        delay(30);
      }


since anything not inside the case is outside the case. But I think what you are looking for is this:

if ((now.hour() >= 10) && (now.hour() < 17))
      {
        lcd.setCursor(5, 3);
        lcd.print("Open window");
        delay(30);
      }
      if ((now.hour() < 10) || (now.hour() >= 17))
      {
        lcd.setCursor(5, 3);
        lcd.print("Closed window");
        delay(30);
      }

Hi Jimmus

Thanks for your help
This code I already tested and it did not work!