It's very hard to read this code example since many parts are missed, very wrong tabulation and coding style, 0 comments. I would also recommend to use // or /* */ comments and put your "THIS CODE" there so it could be found instantly, otherwise I had to search in browser. I believe appendDayString function and public in last function is also missing.
Always put DOC-comments above each function describing what exactly function and each param does does, each param itself and return value. In case of Java there is Javadoc
Could you provide:
And a use-case example where you have data X and result Y.