I have been googling this issue for over 3 hours now and I've come up with nothing so far. Thought maybe someone on the forums here might have some insight.
I'm working on a program that uses an Arduino UNO and a DS1307 RTC module to display the date and time on a 20x4 LCD screen. I can get it to show the numerical date and time just fine but when I try to output the day of the week in alphabetical format, it always gives me "Thursday" regardless of the date.
I'm using the following command to output the day of the week:
lcd.print(dayStr(weekday()));
Seems pretty simple, the rest of the date/time variables work pretty much the same way except without the string function. Does anyone have any ideas what I'm doing wrong? I can't believe something so simple is causing such a headache for me!
I gave "lcd.print(dayStr(2)); " a try and it gave me Monday which is good and got me thinking a bit. For all my other variables, I was using ones formatted like "tm.Month" except for the weekday which I was using "weekday()".
I looked over the variables that are part of the Time.h library and noticed that there was one called "tm.Wday". Decided to substitute that for "weekday()" so the line of code now looks like:
lcd.print(dayStr(tm.Wday));
Much to my relief, the program now works properly. I changed the date a couple times and it works perfect every time! Thank you for your help!
I had trouble getting the library to work, so I went back and started looking at the spec sheet, and a lot of things got much more clear. Take a look at the Timekeeper Registers, Table 2 on page 8 of: