//ESP32Time rtc;
#include <ESP32Time.h>
#include <TM1637.h>

const int CLK = 12;            //ESp32 GPIO2
const int DIO = 13;           // ESP32 GPIO4
ESP32Time rtc(0);           // offset in seconds GMT+0
TM1637 tm;                 // Instantiate a tm object
bool colon = true;  

void setup() {
  Serial.begin(115200);
  rtc.setTime(30, 49, 23, 16, 4, 2024);  // 16th April 2024 23:50:30
  tm.begin(CLK, DIO, DIO);  //Clock, Data In-Out, digit number
  tm.displayClear();
  tm.setBrightness(7);     // full brightness, default is 3
}
 
void loop() {

  Serial.println(rtc.getTime("%A, %B %d %Y %H:%M:%S"));   // (String) returns time with specified format 
  // formating options  http://www.cplusplus.com/reference/ctime/strftime/
  struct tm timeinfo = rtc.getTimeStruct();
  //Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S");   //  (tm struct) Sunday, January 17 2021 07:24:38
  tm.displayTime(rtc.getHour(true),rtc.getMinute(), colon); // display the numbers
  colon = !colon;         // toggle colon
  delay(1000);
}
4-Digit Display