Compare times

UKHeliBob:
You have been given examples of how to do it.

The easiest way is to test whether now.hour() is greater or equal to 10 and now.hour() is less than 17. If so then display "Open window", else display "Close window". You said that you tried it and it didn't work. Please post your code.

Hello UKHeliBob

Actually the code here posted before does not work well, I after some tests discovered what was the error as you can see in the codes below.

The first one does not work well, the second one works well

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

It would be interesting to know how to compare with the full hours as well,
if ((now.hour () <10:00) || (now.hour ()> = 18:00))
If I look I can help thank you