< previous page page_122 next page >

Page 122
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
date = Nth_DOW_of_month (1, DOW_MONDAY, MONTH_FEBRUARY, year);
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
2.1.2.) N is fixed by rule. Use the number-of-DOWs rule to obtain the value of N, then apply the Nth-DOW rule. The last Sunday in July is obtained as:
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
int n;
n = number_of_DOWs_in_month (DOW_SATURDAY, MONTH_JULY, year);
date = Nth_DOW_of_month (n, DOW_SATURDAY, MONTH_JULY, year);
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
Likewise, the last Sunday but one in August can be obtained as:
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
n = number_of_DOWs_in_month (DOW_SUNDAY, MONTH_AUGUST, year);
n--;
date = Nth_DOW_of_month (n, DOW_SUNDAY, MONTH_AUGUST, year);
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
The Nth full weekend variant must be addressed separately by its own special routine, owing to the nature of the additional logical constraints. The third full weekend in July would start on the Saturday calculated by:
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
date = Nth_full_weekend (3, MONTH_JULY, year);
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
and end on the following day  the Sunday whose date can be determined by simply incrementing date.day, since the day must fall in the month as the preceding day.
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
2.2.) The date M days before or after the Nth DOW. Use the Nth-DOW rule to obtain the date of the Nth DOW, then calculate the date before or after it using the date-before or date-after rule. The given example of the day five days after the fourth Thursday in November would be realized as:
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
date1 = Nth_DOW_of_month (4, DOW_THURSDAY, MONTH_NOVEMBER, year);
date2 = date_N_days_after_date (5, &date1);
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
2.3.) The Mth DOW before or after the Nth DOW of a month. Use the Nth-DOW rule to obtain the date of the Nth DOW. Then use the Nth-DOW-before or -after rule to obtain the date of the Mth DOW. The date of the given example of Kinderzeche, defined as the Saturday before the third Monday in July, gives M = 1 and N = 3, realized as:
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
date1 = Nth_DOW_of_month (3, DOW_MONDAY, MONTH_JULY, year);
date2 = Nth_DOW_before_date (1, DOW_SATURDAY, &date1);

 
< previous page page_122 next page >