Examples of expanding year values
The examples in this topic illustrate how various settings of DBCENTURY cause abbreviated years to be expanded in DATE and DATETIME values.
DBCENTURY = P
Example data type: DATE
Current date: 4/6/2003
User enters: 1/1/1
Prefix with "19" expansion : 1/1/1901
Prefix with "20" expansion: 1/1/2001
Analysis: Both are prior to current date, but 1/1/2001 is closer to
current date.
Important: The
effect of DBCENTURY depends on the current date from the system
clock-calendar. Thus, 1/1/1, the abbreviated date in this example,
would instead be expanded to 1/1/1901 if the current date were 1/1/2001
and DBCENTURY = P.
DBCENTURY = F
Example data type: DATETIME year to month
Current date: 5/7/2005
User enters: 1-1
Prefix with "20" expansion: 2001-1
Prefix with "21" expansion: 2101-1
Analysis: Only date 2101-1 is after the current date, so it is chosen.
DBCENTURY = C
Example data type: DATE
Current date: 4/6/2000
User enters: 1/1/1
Prefix with "19" expansion : 1/1/1901
Prefix with "20" expansion: 1/1/2001
Prefix with "21" expansion: 1/1/2101
Analysis: Here 1/1/2001 is closest to the current date, so it is chosen.
DBCENTURY = R or DBCENTURY Not Set
Example data type: DATETIME year to month
Current date: 4/6/2000
User enters: 1-1
Prefix with "20" expansion: 2001-1
Example data type: DATE
Current date: 4/6/2003
User enters: 0/1/1
Prefix with "20" expansion: 2000/1
Analysis: In both examples, the Prefix with "20" algorithm is used.
Setting DBCENTURY does not affect HCL Informix® products when the locale specifies a non-Gregorian calendar. The leading digits of the current year are used for alternative calendar systems when the year is abbreviated.