Later on if i encounter some "0's" stuff i think i'll just sort it out with some conditional statements
I'm not sure what you mean by this. If you don't want to have a week numbered zero, you could just add one to the week number, but keep in mind that some months will end up having up to six weeks and the first and last "weeks" will almost always end up having less than seven days:
_________ Oct 2017 _________
Week 1: 01
Week 2: 02 03 04 05 06 07 08
Week 3: 09 10 11 12 13 14 15
Week 4: 16 17 18 19 20 21 22
Week 5: 23 24 25 26 27 28 29
Week 6: 30 31
As others have said, talk to your client / boss about how they define "week of month". A common system is the ISO 8601 week number, maybe your client / boss would be happier with that system, since every week will have seven days. Also note in the following table how some weeks have two week_of_month-based "names" under the above system.
________________________ 2017 ________________________
Week Mon Tue Wed Thu Fri Sat Sun
52 Dec 26 27 28 29 30 31 Jan 01 (Dec Week 6,
+Jan Week 1)
1 02 03 04 05 06 07 08 (Jan Week 2)
2 09 10 11 12 13 14 15 (Jan Week 3)
3 16 17 18 19 20 21 22 (Jan Week 4)
4 23 24 25 26 27 28 29 (Jan Week 5)
5 30 31 Feb 01 02 03 04 05 (Feb Week 2,
+Jan Week 6)
...
39 25 26 27 28 29 30 Oct 01 (Oct Week 1,
+Sep Week 5)
40 02 03 04 05 06 07 08 (Oct Week 2)
41 09 10 11 12 13 14 15 (Oct Week 3)
42 16 17 18 19 20 21 22 (Oct Week 4)
43 23 24 25 26 27 28 29 (Oct Week 5)
44 30 31 Nov 01 02 03 04 05 (Nov Week 2,
+Oct Week 6)
...
Update: Fixed bug that weekdays weren't properly aligned. Also added the week_of_month-based "names". |