I hope this is just a newbie "Oops".
For context, I'm using the Adafruit RTCLib. I'm reading data from a DS1307 RTC: communication with the chip is fine.
I have two arrays:
char daysOfTheWeek[7][10] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
char monthsOfTheYear[12][10] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
The daysOfTheWeek came from an Adafruit tutorial. I created the monthsOfTheYear following the example.
However, when I run this code:
Serial.print("Day of the week ");
Serial.print(now.dayOfTheWeek());
Serial.print(" is ");
Serial.println(daysOfTheWeek[now.dayOfTheWeek()]);
Serial.print("Month ");
Serial.print(now.month());
Serial.print(" is ");
Serial.println(monthsOfTheYear[now.month()]);
Serial.println();
delay(5000);
my output is:
Day of the week 2 is Tuesday
Month 11 is December
The day of the week is correct, but the month is wrong. What am I doing wrong?