Create file name with date stamp each day

I changed the filename variable declaration to char filename[12] = {0}; and things worked just fine.

Did you change the length of the filename to match ?

Why are you messing around with Strings, especially as you convert the String to a C style string (a zero terminated array of chars) before using it.

The array of chars used by C style strings needs a extra entry over and above the number of characters to hold the terminating zero.