private void checkForNight(final ZonedDateTime TIME){
  int hour=TIME.getHour();
  int minute=TIME.getMinute();
  if (0 <= hour && minute >= 0 && hour <= 5 && minute <= 59 || 17 <= hour && minute <= 59 && hour <= 23 && minute <= 59) {
    if (isNightMode())     return;
    setNightMode(true);
  }
 else {
    if (!isNightMode())     return;
    setNightMode(false);
  }
}

private void checkForNight ( final ZonedDateTime TIME ) { int hour = TIME . getHour ( ) ; int minute = TIME . getMinute ( ) ; if ( 0 <= hour && minute >= 0 && hour <= 5 && minute <= 59 || 17 <= hour && minute <= 59 && hour <= 23 && minute <= 59 ) { if ( isNightMode ( ) ) return ; setNightMode ( true ) ; } else { if ( ! isNightMode ( ) ) return ; setNightMode ( false ) ; } }
calling this method will check for the current time of the day and switches on / off the night mode .
