#include <WiFi.h>
#include <time.h> // Include the time library
void setup() {
Serial.begin(115200);
// Connect to WiFi network
WiFi.begin("Wokwi-GUEST", "");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.println("Connecting to WiFi...");
}
// Initialize system time
configTime(0, 0, "pool.ntp.org");
// Get and print current local time
}
void loop() {
// Your loop code here
struct tm timeinfo;
getLocalTime(&timeinfo);
Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S");
}