|
|
|
|
|
|
|
The day_of_week_abbreviation () function (Listing 5.9, page 96) provides a standard three-character abbreviation in English for the names of the days of the week. The naming scheme is nearly universal in English, and corresponds to the naming scheme used in day_of_week_name () above. The abbreviation rule is simply the use of the first three letters of the name. |
|
|
|
|
|
|
|
|
In another language, the names may be substituted in this function or another function written for the other language using this function as a template. Care should be exercised to observe the conventions of the language and culture. In addition, certain abbreviation rules may not be workable in a particular language, even if they are accepted. |
|
|
|
|
|
|
|
|
As an example, German allows either Samstag or Sonnabend for Saturday in English. The choice of Sonnabend, and a corresponding "Son" abbreviation, would run afoul of the fact that Sonntag corresponds to Sunday in English and would generate the same "Son" abbreviation, by the rule used. Thus, either the use of Samstag would be required or the abbreviation rule would need to be changed. This sort of possibility is one reason why this function is written separately, rather than using the output of day_of_week_name (). |
|
|
|
|
|
|
|
|
Although this particular example presents no insuperable difficulty, either culturally or algorithmically, each situation must be examined individually and with care. Not all languages capitalize the names of the days of the week (e.g., Spanish), nor do all languages distinguish all the days of the week with names (e.g., Hebrew or Portuguese). Not all cultures use the week of seven days as a unit. |
|
|
|
|
|
|
|
|
5.5.2
Date and Day Calculations |
|
|
|
|
|
|
|
|
The SCDTL system gathers together a set of functions, commonly required in many applications, concerned with calculating dates and elapsed periods that use the Julian Day number system. This group is referred to as date and day calculations. |
|
|
|
|
|
|
|
|
days_between_dates () returns the number of days between two dates. |
|
|
|
|
|
|
|
|
days_since_date () returns the number of days, from a given past date, to the present date. |
|
|
|
|
|
|
|
|
days_until_date () returns the number of days from the current system date until a given future date. |
|
|
|
|
|
|
|
|
date_N_days_after_date () returns the date that occurs N days after a given date. |
|
|
|
|
|
|
|
|
date_N_days_before_date () returns the date that occurs N days before a given input date. |
|
|
|
|
|