Dismiss
InnovationQ will be updated on Sunday, Oct. 22, from 10am ET - noon. You may experience brief service interruptions during that time.
Browse Prior Art Database

# Generalized Procedure for Converting 2-digit Years to 4-digit Years

IP.com Disclosure Number: IPCOM000032980D
Original Publication Date: 2004-Nov-19
Included in the Prior Art Database: 2004-Nov-19
Document File: 2 page(s) / 65K

IBM

## Abstract

Generalized Method For Converting 2-Digit Years To 4-Digit Years

This text was extracted from a PDF file.
At least one non-text object (such as an image or picture) has been suppressed.
This is the abbreviated version, containing approximately 54% of the total text.

Page 1 of 2

Generalized Procedure for Converting 2-digit Years to 4-digit Years

Disclosed is an algorithm for converting 2-digit years to 4-digit (or more) years. Although using the full 4-digit year is the only completely nonambiguous notation, many legacy databases still contain 2-digit years. And many user interfaces allow the user to input the more common 2-digit year. These 2-digit years should be converted to 4-digit years for use.

The most common method of converting these dates is to use a fixed "pivot year". For example, if the pivot year is 50, then any 2-digit year less than 50 is considered to be one century (e.g. 2000), and any year greater than 50 is considered to be another century (e.g. 1900). There are several problems with this approach. One is that this breaks down as the pivot year approaches, and the pivot year and centuries must be changed to compensate. This can be a substantial effort. Another is that this method has been patented, and is being licensed for a fee.

The algorithm described here is more flexible, and is maintenance free. It relies on being able to acquire the full current year from the computer's operating system or other source. It uses only integer arithmetic, so is extremely fast. It will work for any year up to the limits of the computer (year 9999 and even beyond). The steps are:

Retrieve the complete current date and separate it into century and year

components (cc and yy).

Determine the two offsets to be used. These should be set based on the

expected input, but should add up to 100. For the general case, 50 might be used for both. Some specific implementations might find other values (such as 75 and 25) to be more appropriate...