Century Year Offset (-yy)

Use Century Year Offset (-yy) to determine the start of the 100-year period in which a date with a two-digit year is valid.

Operating system and syntax UNIX / Windows -yy n
Use with Maximum value Minimum value Single-user default Multi-user default
Client Session, Database Server 1950 1950
n
A four-digit year (1990, for example). The default is 1950.

Some OpenEdge applications reserve only two digits for the year in the date format. When, for example, -yy is set at 1950, the AVM determines if the two-digit year value is greater or less than 50. If the year is greater than 50, the AVM assumes that the date is in the twentieth century. If the year is less than 50, the AVM assumes that the date is in the twenty-first century.

The following table shows some examples of -yy.

-yy Year (as supplied in DATE format) Result of year function
1900 50-99 1950-1999
00-49 1900-1949
1950 50-99 1950-1999
00-49 2000-2049
1980 80-99 1980-1999
00-79 2000-2079

Notice that all two-digit year values expand into the 100-year period beginning with -yy.

To test the effect of -yy, start OpenEdge with a different -yy value and run the following procedure:

DEFINE VARIABLE dDate AS DATE NO-UNDO.
DISPLAY "Enter date or Press F4 to end." WITH FRAME msg.
REPEAT:
  SET dDate LABEL "Date" WITH SIDE-LABELS.
  DISPLAY YEAR(dDate) FORMAT "9999" LABEL "=> Year" WITH SIDE-LABELS.
END. 

If you use a hard-coated date containing a two-digit year in a .p file, the AVM honors the -yy parameter and expands the two-digit year to a four-digit year during compilation. However, this may not match the runtime -yy. For this reason, Progress Software Corporation recommends that you use four digit years for hard-coated dates in programs. For example:

DEFINE VARIABLE hdate AS DATE INITIAL 01/01/2001. 
Note: When you dump or load any database, the -yy setting you load with must match the -yy setting that was used for dumping, unless you use the Four Digit Year Default (-yr4def) startup parameter for dumping.

This startup parameter provides the same functionality as the SESSION:YEAR-OFFSET attribute.