You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ezTime/examples/Timezones/Timezones.ino

34 lines
923 B

7 years ago
#include <ezTime.h>
#include <WiFi.h>
void setup() {
Serial.begin(115200);
WiFi.begin("your-ssid", "your-password");
// Uncomment the line below to see what it does behind the scenes
// ezTime.debug(INFO);
ezTime.waitForSync();
Serial.println();
Serial.println("UTC: " + UTC.dateTime());
Timezone myTZ;
myTZ.setLocation("Pacific/Auckland"); // Anything with a slash in it is interpreted as an official timezone name
Serial.println("Auckland: " + myTZ.dateTime()); // https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
myTZ.setLocation("Paris, Texas"); // Anything else is parsed as an address to see if that resolves
Serial.println("Paris, Texas: " + myTZ.dateTime());
myTZ.setLocation(""); // The empty string is resolved to the GeoIP location of your IP-address
Serial.println("Your local time: " + myTZ.dateTime());
}
void loop() {
}