Aller au contenu principal

Date windowing


Date windowing


Date windowing is a method by which dates with two-digit years are converted to and from dates with four-digit years. The year at which the century changes is called the pivot year of the date window. Date windowing was one of several techniques used to resolve the year 2000 problem in legacy computer systems.

Reasoning

For organizations and institutions with data that is only decades old, a "date windowing" solution was considered easier and more economical than the massive conversions and testing required when converting two-digit years into four-digit years.

Windowing methods

There are three primary methods used to determine the date window:

  • Fixed pivot year: simplest to code, works for most business dates.
  • Sliding pivot year: determined by subtracting some constant from the current year, typically used for birth dates.
  • Closest date: Three different interpretations (last century, this century, and next century) are compared to the current date, and the closest date is chosen from the three.

FOCUS

Information Builders's FOCUS "Century Aware" implementation allowed the user to focus on field-specific and file-specific settings.

This flexibility gave the best of all three major mechanisms: A school could have file RecentDonors set a field named BirthDate to use

DEFCENT=19 YRTHRESH=31, covering those born 1931-2030.

Those born 2031 are not likely to be donating before 2049, by which time those born 1931 would be 118 years old, and unlikely current donors. DEFCENT and YRTHRESH for a file containing present students and recent graduates would use different values.

Examples

Below is a simple example of fixed date windowing COBOL code, often used to figure the century for ordinary business dates.

The above code establishes a fixed date window of 1960 through 2059. It assumes that none of the receipt dates are before 1960, and should work until January 1, 2060.

Some systems have environment variables that set the fixed pivot year for the system. Any year after the pivot year will belong to this century (the 21st century), and any year before or equal to the pivot year will belong to last century (the 20th century).

Some products, such as Microsoft Excel 95 used a window of years 1920–2019 which had the potential to encounter a windowing bug reoccurring only 20 years after the year 2000 problem had been addressed.

The IBM i operating system uses a window of 1940-2039 for date formats with a two-digit year. In the 7.5 release of the operating system, an option was added to use a window of 1970-2069 instead.

See also

  • Serial number arithmetic, a form of windowing for sequential counters

References


Text submitted to CC-BY-SA license. Source: Date windowing by Wikipedia (Historical)


ghbass