If someone were to say something happens in the first or last week of some month, how would you define that span?
I'm working on a library that needs to handle this kind of thing in an intuitive way, but my intuition doesn't claim one case or the other.
I can make it select different behavior but still need a good default.
For a concrete example I'll just to pick an random month: July 2008
s m t w r f s
--------------------
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
(Note: I'll assume the week starts with Sunday but the question could be asked re Monday as well)
What span is the first week of the month?
The second week is just the 7 days following the first right?
What span is the last week of the month?
Non wiki comments welcome
The first week of the month is the seven days starting with the first day of the month. Hence, in your example, the first week would be Tuesday, the 1st through Monday, the 7th. This way, the first through 4th weeks would always be fully contained within the month, and only the 5th week would cross over.
26th-31st July (Sunday to Friday) would be the fifth or final week of the month. How did the Months of the year get their names? If the measurement of time is a man-made construct, why is it that we have 4 weeks in a month and not 2 weeks a month totaling 24 months a year?
Count the number of days in the month and divide that number by 7, which is the number of days in one week. For example, if March has 31 days, there would be a total of 4.43 weeks in the month.
It may start as a Sunday or a Monday or any day as a matter of fact and ends on the 7th day of the month. Second week like wise are the next 7 days after the first week and so on for the 3rd and 4th week.
There is no answer because it varies even inside a country.
However, this source seems to think it's defined by the ISO standard as the first week that contains a thursday. However the above source says that the ISO standard does not list a specification for 'first week of the month'
More than 300 chars - sorry!
The ISO 8601 standard defines the first week of the YEAR as:
calendar week number
ordinal number which identifies a calendar week within its calendar year according to the rule that the first calendar week of a year is that one which includes the first Thursday of that year and that the last calendar week of a calendar year is the week immediately preceding the first calendar week of the next calendar year
There is nothing in ISO 8601 about the first week of the month because, as has been noted, the definition varies by country (and even by company, for example). Oh, and the standard says that weeks start on Monday.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With