Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compute week number.
#9
(07-28-2008, 11:29 PM)Clippy link Wrote:There are three ways to calculate a week number:

1) The first week has the first day in it and ends saturday. Then the next
     weeks are just Mondays to Saturdays.

2) The first week starts on the 1st and ends on the 7th. This makes the 8th
     part of the second week.

3) ISO skips the first week if the first day is on a Thursday or later.

So, besides ISO, which way do you want it calculated? Sorta like "rounding".
The method that has always made sense to me is your method #1, with a minor correction to read  "Then the next weeks are just SUNDAYS to Saturdays."

To summarize this method:
* The first week has the first day-of-the-year in it.
* The first week ends on a Saturday,
* Subsequent weeks begin on a Sunday and end on a Sarturday, except for the last week of the year, which may be shorter.

For a year beginning on a Saturday, this method will give us:
* The first week begins and ends on January 1st.
* The second week begins on January 2nd and ends on January 8th.

For a leap year beginning on a Saturday (like 1972, 2000, 2028), this method will give us:
* December 31st, the last day of the year, falls on a Sunday, and is the beginning and end of week number 54.

Regards..... Moneo
Reply


Messages In This Thread
Compute week number. - by Moneo - 07-06-2008, 05:39 AM
Re: Compute week number. - by Clippy - 07-23-2008, 05:03 AM
Re: Compute week number. - by Moneo - 07-24-2008, 07:39 AM
Re: Compute week number. - by Clippy - 07-25-2008, 01:14 AM
Re: Compute week number. - by Moneo - 07-25-2008, 06:07 AM
Re: Compute week number. - by Clippy - 07-26-2008, 12:08 AM
Re: Compute week number. - by Moneo - 07-27-2008, 11:46 PM
Re: Compute week number. - by Clippy - 07-28-2008, 11:29 PM
Re: Compute week number. - by Moneo - 07-29-2008, 05:05 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)