Smart Clock for ESP32 & Arduino
Using NTP libraries on microcontrollers can be heavy and difficult to debug. A simple HTTP GET request to our API gives you pre-formatted time, DST status, and day of year in a lightweight JSON string.
CPP
#include <HTTPClient.h>
#include <ArduinoJson.h>
void getTime() {
HTTPClient http;
http.begin("https://time.now/developer/api/timezone/Europe/Paris");
int httpCode = http.GET();
if (httpCode > 0) {
String payload = http.getString();
// Parse JSON (Capacity depends on your needs)
StaticJsonDocument<512> doc;
deserializeJson(doc, payload);
const char* datetime = doc["datetime"];
bool is_dst = doc["dst"];
Serial.println(datetime);
}
http.end();
}
Why use Time.Now for IoT?
- Reduces code size vs NTP
- Includes DST logic automatically
- Returns Day of Year & Week Number