Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (Français) » UltraLite - Database Management and Reference » UltraLite Database Reference » UltraLite creation parameters


UltraLite nearest_century creation parameter

Controls the interpretation of two-digit years in string-to-date conversions.

{ ulcreate | ulinit | ulload } -o nearest_century=value;...
Allowed values

Integer, between 0 and 100, inclusive




UltraLite automatically converts a string into a date when a date value is expected, even if the year is represented in the string by only two digits. In the case of a two-digit date, you need to set the appropriate rollover value. Two digit years less than the value are converted to 20yy, while years greater than or equal to the value are converted to 19yy.

Choosing an appropriate rollover value typically is determined by:

  • The use of two-digit dates   Otherwise, nearest century conversion isn't applicable. Two-digit years less than the nearest_century value you set are converted to 20yy, while years greater than or equal to the value are converted to 19yy.

    It is recommended that you store four-digit dates to avoid issues with incorrect conversions. See Using unambiguous dates and times.

  • Consolidated database compatibility    For example, the historical SQL Anywhere behavior is to add 1900 to the year. Adaptive Server Enterprise behavior is to use the nearest century, so for any year where value yy is less than 50, the year is set to 20yy.

  • What the date represents: past event or future event   Birth years are typically those that would require a lower rollover value since they occur in the past. So for any year where yy is less than 20, the year should be set to 20yy. However, if the date is used as an expiry date, then having a higher value would be a logical choice, since the date is occurring in the future.

You cannot change the nearest century of an existing database. Instead, you must create a new database.

From Sybase Central, you can configure the nearest century setting in any wizard that creates a database. On the New database creation parameters page, select the Nearest Century option.

From a client application, set this parameter as one of the creation parameters for the create database method on the database manager class.

See also