I have done something similar in the past... what you need to do is order them by date, then loop through each one. Store the date of the first row in a variable called compareDate, then compare the date of the next row to compareDate. If they are different, create a new header with the new date, write the row, put the new date in compareDate, and continue. If they are the same, then just write the row, and continue.
I did a similar thing, but it was a yearly calendar. I used the months as headers -- but it's the same concept.
Hope I was clear enough on how that works.
Good Luck!