< previous page page_215 next page >

Page 215
Americans should also recall that ISO practice has altered the structure of the week in Europe, such that the first day of the week is Monday, not Sunday. This change was made for commercial purposes. This difference has two major consequences for applications:
Applications that display a calendar should observe this convention for the appropriate countries.
The DOW indexing scheme used by SCDTL recognizes Sunday as the first day of the week, so a filter may be useful to convert SCDTL indices to ISO indices. This conversion is very simple, since Sunday is moved from first to last position and since ISO numbering begins with 1. The value 0 is detected and changed to 7. See the iso_date_to_ywd () routine for an example (section 8.4.5.1).
The change in ''first DOW" was apparently made on a country-by-country basis. Danish informants, for example, state that Denmark made the change effective 1 January 1973 as a result of a decision to follow the ISO 8601 standard. Not surprisingly, the "week number" system was introduced into that country at the same time.
8.4.4.1
iso_week_number ()
This routine (Listing 8.10) returns the week number of the year in which a given date falls, as defined by the ISO.
(continued)
Listing 8.10
   if (m == 1)
      {
      if ( (d == 3) && (dow == DOW_SUNDAY) )
         y--;
      else
         {
         if ( (d == 2) &&
              ( (dow == DOW_SATURDAY) || (dow == DOW_SUNDAY) ))
            y--;
         else
            {
            if ( (d == 1) &&
                 ( (dow == DOW_FRIDAY) ||
                   (dow == DOW_SATURDAY) || (dow == DOW_SUNDAY) ))
               y--;
            }
         }
      }


   date2 = make_date (y, 1, 1);
   jd2 = date_to_JD0 (&date2);
   dow = day_of_week_index_JD0 (jd2);

 
< previous page page_215 next page >