I've been trying to get this stupid function to work for days and just cannot get it.
My display looks like this:
1 2 3 4 5 6
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
All I want it to do is have those last 4, 5, 6, and 7 wrap around to the next column. I've tried inserting "\n" different places, but cannot get it to work properly. Can anyone lend me any insight?
You forgot to take into account the offset. You should also print newlines before printing the actual day - you want to wrap before it's too late, after all.
if ((days+offset) % 7 == 0)
You probably don't want to print a newline when the month starts with a sunday (offset=6) either, so you should handle that case.