Date windowing
{{short description|Running software in real time for display and reporting six-digit date into eight-digit date}}
{{Use dmy dates|date=August 2018}}
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
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{{Cite web |url=http://www.ibi.com/special/year2k/dilemma.html |title=Solving the Date Dilemma |last=Kruskopfs |first=Peter |publisher=Information Builders |page=4 |archive-url=https://web.archive.org/web/19961227162929/http://www.ibi.com/special/year2k/dilemma.html |archive-date=27 December 1996 |access-date=2 March 2020 |quote=expanded version of the sliding windows technique .. File and field level settings}} 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 typical example of COBOL code that establishes a fixed date window, used to figure the century for ordinary business dates.
IF RECEIPT-DATE-YEAR >= 60
MOVE 19 TO RECEIPT-DATE-CENTURY
ELSE
MOVE 20 TO RECEIPT-DATE-CENTURY
END-IF.
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.{{cite web|url=https://www.ibm.com/support/pages/new-base-year-support-2-digit-year-date-formats|title=New base year support for 2-digit year date formats|date=2022-05-03|publisher=IBM|access-date=2022-05-04}} In the 7.5 release of the operating system, an option was added to use a window of 1970-2069 instead.{{cite web|url=https://www.itjungle.com/2022/05/03/announcement-day-ibm-lifts-the-veil-on-ibm-i-7-5-and-7-4-tr6/|title=Announcement Day: IBM Lifts The Veil On IBM i 7.5 And 7.4 TR6|date=2022-05-03|website=IT Jungle|author=Alex Woodie|access-date=2022-05-04}}
See also
- Serial number arithmetic, a form of windowing for sequential counters
References
{{Reflist|2|refs=
{{Cite web |url=http://edition.cnn.com/TECH/computing/9902/09/testy2k.idg/index.html |title=COMPUTING Spot & fix Y2K problems in Windows 9x & NT |last=Livingston |first=Brian |date=1999-02-09 |website=CNN |format=html |archive-url=https://web.archive.org/web/20010517090846/http://edition.cnn.com/TECH/computing/9902/09/testy2k.idg/index.html |archive-date=2001-05-17 |access-date=2020-02-13 |quote=The other common behavior that Windows users will experience involves dates in spreadsheet programs such as Microsoft Excel, Lotus 1-2-3, and Corel Quattro Pro. If you have typed all your dates with four-digit years (such as 1/1/1999 and 1/1/2000), you should be fine. But if you have typed two-digit years (such as 1/1/29), you may be surprised at the way different programs handle the date. |df=dmy-all}}
}}