>A year has 52 weeks (but somtimes 53)...but that is not the problem...I have a payroll system that pays weekly, and when a month have 5 weeks, do something special
I think we need to go back to your definition of a "month having weeks". First, every month will
have more than four weeks, except February of a simple year. Now this obviously doesn't mean that then every month has 5 weeks - are we into decimal or fractional weeks here, or is there any other criterion? How do you know from a calendar whether a month has 4 or 5 weeks?
You say October has 5 weeks. The way I look at the calendar, it has three full weeks, and two partial weeks this year and next year, but will have four full weeks and one partial in 2009 (my week starts on Monday). So - how do you define "week belongs to a month"? Is it "four days in that month, week starting on Monday", or what?
Can't code when one doesn't know the specs.