#include "RTClib.h" RTC_DS3231 rtc; char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; void setup () { Serial.begin(9600); if (! rtc.begin()) { Serial.println("Couldn't find RTC"); Serial.flush(); abort(); } Serial.println("Setting the time..."); // When time needs to be set on a new device, or after a power loss, the rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // rtc.adjust(DateTime(2022, 08, 27, 4, 0, 0)); } void loop () { DateTime now = rtc.now(); ////////////////////////////// Serial.print(now.year(), DEC); Serial.print('/'); Serial.print(now.month(), DEC); Serial.print('/'); Serial.print(now.day(), DEC); Serial.print(" ("); Serial.print(daysOfTheWeek[now.dayOfTheWeek()]); Serial.print(") "); Serial.print(now.hour(), DEC); Serial.print(':'); Serial.print(now.minute(), DEC); Serial.print(':'); Serial.print(now.second(), DEC); Serial.println(); delay(2000); }