What is the first week of last week?


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?

  1. June 29 - July 5 -- the week that includes the first
  2. July 6 - 12 -- the first week that is all the way into the month

The second week is just the 7 days following the first right?

What span is the last week of the month?

  1. July 27 - Aug 2 -- ditto but the last day
  2. July 20 - 26 -- ditto but the last week

Non wiki comments welcome

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.