home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / mod.std.unix.v9 / text0032.txt < prev    next >
Encoding:
Internet Message Format  |  1987-06-30  |  2.6 KB

  1. From: seismo!gatech!hpcnof!hpfcla!hpfclj!hpfcdg!rgt
  2. Date: Mon, 12 Jan 87 15:21:04 est
  3.  
  4. > 2. If the year begins on Saturday and ends on Monday, it will have 54
  5. >    weeks.  Obviously they cannot be numbered 00 to 52!
  6.  
  7. Sorry folks, but this is not a bug.  This was transcribed from the X3J11
  8. documentation   titled   "Internationalizing   ANSI   C"  and   numbered
  9. "X3J11/86-125R".  Section  3.2  describes   the  strftime   funtion  and
  10. describes  the %U and %W  directives.  Both are  described as being week
  11. numbers  beginning with either Sunday or Monday and both list a range of
  12. 00 to 52.  (The %W directive  was changed to a %V  directive  because it
  13. conflicts with an existing X/OPEN directive for the nl_cxtime  function,
  14. which is almost identical in operation to strftime.)
  15.  
  16. I believe that the intended week number computation is as described in a
  17. paper  titled  "An  Overview  of  Internationalization"   by  Greger  K.
  18. Leijonjufvud  of Sperry  Corporation  and Gary L.  Lindgren  of AT&T (no
  19. date or number).  In section 3.4.2.4 titled "The Week" it states [with my
  20. corrections and clarifications (rgt)]:
  21.  
  22.     The 7-day week is now predominant.  Each day has its name and is
  23.     also  numbered.  the  number  depends on which day is counted as
  24.     the  starting day of the week:  either  Sunday or Monday.  Weeks
  25.     are also  numbered.  Which  week tath is  counted  as the  first
  26.     depends on the  weekday of January  1st (i.e., if there are 4 or
  27.     more  January  days in the week of Jan 1st, then that is week 1,
  28.     [number 00 (rgt)]  otherwise  it is week [51 or (rgt)] 52 of the
  29.     preceding year.  The calculation  also depends on whether Sunday
  30.     is the first or the last day of the week.)
  31.  
  32. The  maximum  number of weeks in a year would  occur in a leap year with
  33. January 1st on the  Wednesday  of the  Sunday-first  week.  Looking at a
  34. perpetual  calendar,  1964 or 1992 are  useful  examples.  I derive  the
  35. following table:
  36.  
  37.     1963 week ?? = Dec 22 to Dec 28
  38.     1964 week 00 = Dec 29 to Jan 04
  39.     ...
  40.     1964 week 52 = Dec 27 to Jan 02
  41.     1965 week 00 = Jan 03 to Jan 09
  42.  
  43. Conversely,  the  minimum  number of weeks in a year would be occur in a
  44. non-leap  year when  January 1st was on a Thursday  of the  Sunday-first
  45. week.
  46.  
  47.     1986 week ?? = Dec 28 to Jan 03
  48.     1987 week 00 = Jan 04 to Jan 10
  49.     ...
  50.     1987 week 51 = Dec 27 to Jan 02
  51.     1988 week 00 = Jan 03 to Jan 09
  52.  
  53. Conclusion:  A week-aligned  year may will have at least 52 weeks and at
  54. most  53  weeks.  The  first  day  (00) of the  first  week  (00) of the
  55. week-aligned  year may be as early as Dec 29 and as late as Jan 04.
  56.  
  57. All of the  arguements  can also be applied to a Monday  first week with
  58. only minor changes.
  59.  
  60. Volume-Number: Volume 9, Number 33
  61.  
  62.