You are here: Field Types > Packed > Century Codes in Packed Date Fields

Century Codes in Packed Date Fields

Two digits have long been used to represent the year in packed numeric fields used to store dates. As a Y2K fix, some systems added a third digit called a century code to indicate the century to which a two digit year belongs.

The most common century codes use either a leading “0” or a leading “1” to indicate the twentieth century:

When a leading “0” in the packed field is used to represent 1900, any other number, usually “1”, represents 2000.

0990101 represents January 1, 1999

1000101 represents January 1, 2000

When a leading “1” in the packed field is used to represent 1900, any other number, usually “2”, represents 2000.

1990101 represents January 1, 1999

2000101 represents January 1, 2000

To Have Analyzer Recognize the Century Code

After using the Data Definition Wizard to define a packed numeric field, you must manually modify the date format as follows:

1. Select Edit from the menu and choose Edit Table Layout. Analyzer displays the Table Layout window.
2. Under the [Fields/Expressions] tab, in the field list View, double-click the numeric field you want to edit. Analyzer displays the field format options.
3. Click the Advanced button and select the Date parameter checkbox.
4. Specify a date format in the Format drop-down list. Then, in the Format text box, add a “0” or a “1” to the beginning of the packed date field format to specify the digit representing the 1900s.
For example, the format “0YYMMDD” indicates that 0991231 is December 31, 1999. Similarly, “1YYMMDD” indicates that 1991231 is December 31, 1999.
5. Click [Accept Entry], then click [OK] to save the change.

You can see the formatted field in the View.