#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 20, 4);

unsigned long previousMillis = 0;
const long interval = 1000;
int seconds = 40;
int minutes = 59;
int hours = 11;

void setup() {
  lcd.init();
  lcd.backlight();
  lcd.setCursor(1, 0);
  lcd.print("Digital Clock");
}

void loop() {
  unsigned long currentMillis = millis();

  if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;
    seconds++;

    if (seconds >= 60) {
      seconds = 0;
      minutes++;
    }

    if (minutes >= 60) {
      minutes = 0;
      hours++;
    }

    lcd.setCursor(7, 1);
    lcd.print((hours < 10 ? "0" : "") + String(hours) + ":" +
              (minutes < 10 ? "0" : "") + String(minutes) + ":" +
              (seconds < 10 ? "0" : "") + String(seconds));
  }
}