1
0
mirror of https://github.com/taigrr/arduinolibs synced 2025-01-18 04:33:12 -08:00

Calculating the day of week from a date

This commit is contained in:
Rhys Weatherley
2012-06-11 10:05:24 +10:00
parent 00eea28357
commit fa7df64f52
4 changed files with 64 additions and 0 deletions

View File

@@ -11,6 +11,10 @@ This example is placed into the public domain.
SoftI2C i2c(A4, A5);
DS3232RTC rtc(i2c);
const char *days[] = {
"Mon, ", "Tue, ", "Wed, ", "Thu, ", "Fri, ", "Sat, ", "Sun, "
};
const char *months[] = {
" Jan ", " Feb ", " Mar ", " Apr ", " May ", " Jun ",
" Jul ", " Aug ", " Sep ", " Oct ", " Nov ", " Dec "
@@ -52,6 +56,7 @@ void loop() {
Serial.println();
Serial.print("Date: ");
Serial.print(days[RTC::dayOfWeek(&date) - 1]);
Serial.print(date.day, DEC);
Serial.print(months[date.month - 1]);
Serial.print(date.year);