#include <LiquidCrystal.h>
#include <RTClib.h>
RTC DS1307 RTC;
void setup() {
serial.begin(9600);
Wire.begin();
RTC.begin();
RTC.adjust(DateTime(2022,1,11,15,15,15));
}
void loop() {
DateTime now = RTC.now();
lcd,setCursor(4,0);
lcdData(now.year());
lcd.print('-');
lcdData(now.month());
lcd.print('-');
lcdData(now.day());
lcd,setCursor(4,1);
IcdData(now.hour());
lcd.print(':');
lcdData(now.minute());
lcd.print(':');
lcdData(now.second());
}
void lcdData(uint8_t data){
if(data<10)
{
lcd.print(0);
lcd.print(data);
}
else{
lcd.print(data);
}
}