How to Detect timezone automatically

Hi @ScruffR
I am doing the digital clock application. And I am trying to set the time zone automatically based on the ip address. With the help of the below code I got the IP address in serial monitor .
void handler(const char *topic, const char *data) {
Serial.println("received " + String(topic) + ": " + String(data));
}

void setup() {
Serial.begin(115200);
Particle.subscribe(“particle/device/ip”, handler);
Particle.publish(“particle/device/ip”);
}

But am not able to figure out that converting into time zone. If you share any information regarding this it would be helpful for me :smile:

This has been requested several times on this forum before, but the usual response is that IP isn't a very reliable source for that information.
But if you search the forum you may find a lot more elaborate explanations why this is and what to do about it.

BTW, double posting because you didn't get an answer in another thread isn't appreciated - hence I'm closing this one.

3 Likes