The code gets complicated, and I'm too lazy to write it out for you.
You can use the functiondate() to figure out what day jan 1st is. For instance, let's assume it's a wednesday.
So, now you know that the week started at the end of december. So, use the date function again to get the number of days in december, 31, and we know that since the 1st is tueday, the week satrted 3 days prior. Take the 1st of january (also known as the 32nd of december), and subtract 3 from it: 32-3 = 29th.
Now, we know the week ending is 3 days from the 1st, so take the 1st and add 3 and we get the 4th.
We now know that the week was form December 29th - January 4th. Then just repeat for every week of the month.