Date windowing
Date windowing is a method by which dates with two-digit years are converted to and from dates with four-digit years.[1] The year at which the century changes is called the pivot year of the date window.[2] Date windowing was one of several techniques used to resolve the year 2000 problem in legacy computer systems.[3]
Reasoning
[edit]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.[3][4]
Windowing methods
[edit]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
[edit]Information Builders's FOCUS "Century Aware" implementation[5] 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
[edit]Below is a simple example of fixed date windowing COBOL code, often 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.[3]
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).[6]
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.[7]
The IBM i operating system uses a window of 1940-2039 for date formats with a two-digit year.[8] In the 7.5 release of the operating system, an option was added to use a window of 1970-2069 instead.[9]
See also
[edit]- Serial number arithmetic, a form of windowing for sequential counters
References
[edit]- ^ Bridis, Ted (16 March 1999). "Temporary Y2K fix may last only a generation". Online Athens. Archived from the original (html) on 4 March 2016. Retrieved 13 February 2020.
Using windowing, programmers instruct software to guess the century for dates that fall within a specific "window" of time, such as the next three decades. The computer interprets the year based on a future so-called hinge date, or pivot, that programmers choose arbitrarily
- ^ Healton, Gilbert (12 July 2014). "The Best of Dates, The Worst Of Dates". Archived from the original (html) on 13 February 2020. Retrieved 13 February 2020.
A pivot year, also known as date windowing, takes a two-digit year and expands it to determine which century the year is in. Typically the year is converted to either a full four-digit year or into the year-1900 format, as appropriate to the application at hand.
- ^ a b c Raymond B. Howard. "The Case for Windowing: Techniques That Buy 60 Years". Year/2000 Journal (Mar/Apr 1998).
Windowing is a long-term fix that should keep legacy systems working fine until the software is redesigned...
- ^ McNish, Larry (30 December 2019). "The Y2K Pivot Year Problem". Archived from the original on 15 January 2020. Retrieved 13 February 2020.
The choice of the actual pivot year was made by companies based on their historical records. It was in no way an industry standard, nor was this approach in any way professionally recommended. But it would work for a while.
- ^ Kruskopfs, Peter. "Solving the Date Dilemma". Information Builders. p. 4. Archived from the original on 27 December 1996. Retrieved 2 March 2020.
expanded version of the sliding windows technique .. File and field level settings
- ^ "Chapter 1: Pivot Year". APPX Software, Inc. 2003. Archived from the original (html) on 22 September 2012. Retrieved 13 February 2020.
By defining a pivot year, you direct APPX to determine what century a particular year belongs to. For example, if the pivot year is set to 35, then any date field with a year greater than 35 will be assumed by APPX to have a century value of 19. Any date field with a year less than or equal to the pivot year will be assumed by APPX to have a century value of 20.
- ^ Livingston, Brian (9 February 1999). "COMPUTING Spot & fix Y2K problems in Windows 9x & NT". CNN. Archived from the original (html) on 17 May 2001. Retrieved 13 February 2020.
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.
- ^ "New base year support for 2-digit year date formats". IBM. 3 May 2022. Retrieved 4 May 2022.
- ^ Alex Woodie (3 May 2022). "Announcement Day: IBM Lifts The Veil On IBM i 7.5 And 7.4 TR6". IT Jungle. Retrieved 4 May 2022.