ropg / ezTime

ezTime — pronounced "Easy Time" — is a very easy to use Arduino time and date library that provides NTP network time lookups, extensive timezone support, formatted time and date strings, user events, millisecond precision and more.
MIT License
343 stars 93 forks source link

examples Timezones.ino proposed enhancement - thanks #155

Open artofit opened 2 years ago

artofit commented 2 years ago

include

include

void setup() {

Serial.begin(115200);

WiFi.begin("your-ssid", "your-password");
while (WiFi.status() != WL_CONNECTED) {
delay(750);
Serial.println("-no connected, retrying in 0.75sec");
}
Serial.println("");
Serial.println("WIFI CONNECTED!");
Timezone    Berlin;
waitForSync();
Berlin.setLocation("Europe/Berlin");
Berlin.setDefault();

Serial.println();
Serial.println("Time in various internet standard formats ...");
Serial.println();
Serial.println("ATOM:        " + dateTime(ATOM)); 
Serial.println("COOKIE:      " + dateTime(COOKIE));
Serial.println("IS8601:      " + dateTime(ISO8601));
Serial.println("RFC822:      " + dateTime(RFC822));
Serial.println("RFC850:      " + dateTime(RFC850));
Serial.println("RFC1036:     " + dateTime(RFC1036));
Serial.println("RFC1123:     " + dateTime(RFC1123));
Serial.println("RFC2822:     " + dateTime(RFC2822));
Serial.println("RFC3339:     " + dateTime(RFC3339));
Serial.println("RFC3339_EXT: " + dateTime(RFC3339_EXT));
Serial.println("RSS:         " + dateTime(RSS));
Serial.println("W3C:         " + dateTime(W3C));
Serial.println();
Serial.println("l ~t~h~e jS ~o~f F Y, g:i A:\"" + dateTime("l ~t~h~e jS ~o~f F Y, g:i A") + "\"");
Serial.println("l j M Y, G:i\t\"" + dateTime("l j M Y, G:i") + "\"");
Serial.println("D G:i j F Y\t\"" + dateTime("D G:i - j F Y") + "\"");
Serial.println("e D H:i:s j F Y\t\"" + dateTime("e D H:i:s - j F Y") + "\"");
Serial.println("Y-m-d H:i:sP\t\"" + dateTime("Y-m-d H:i:sP") + "\"");
Serial.println("T Y-m-d H:i:s\t\"" + dateTime("T Y-m-d H:i:s") + "\"");

/*
IF you want the month's or day's name displayed in your language,
edit ezTime.h
search for
#define EZTIME_LANGUAGE
and change with your language
languages files are under src/lang
*/

}

void loop() { events(); }