How InterBase Stores Date Values
Go Up to Date and Time Data Types
InterBase stores all date values correctly, including those after the year 2000. InterBase always stores the full year value in a DATE
or TIMESTAMP
column, never the two-digit abbreviated value. When a client application enters a two-digit year value, InterBase uses the “sliding window” algorithm, described below, to make an inference about the century and stores the full date value including the century. When you retrieve the data, InterBase returns the full year value including the century information. It is up to client applications to display the information with two or four digits.
InterBase uses the following sliding window algorithm to infer a century:
- Compare the two-digit year number entered to the current year modulo 100.
- If the absolute difference is greater than 50, then infer that the century of the number entered is 20, otherwise it is 19.
For a more detailed explanation of the InterBase algorithm and how it is applied, see the “Working with Dates and Times” chapter in the Embedded SQL Guide.