The DATE data type is changed to support applications that use the Oracle DATE data type expecting that the values include time information (for example, '2009-04-01-09.43.05').
Support for DATE to mean TIMESTAMP(0) is at the database level, and must be enabled before creating the database where support is required. This is achieved by setting the DB2_COMPATIBILITY_VECTOR registry variable to the appropriate value. When a database is created with DATE as TIMESTAMP(0) enabled, the database configuration parameter date_compat is set to ON. After a database is created with DATE as TIMESTAMP(0) support enabled, it cannot be disabled for that database, even if the DB2_COMPATIBILITY_VECTOR registry variable is reset. Similarly, all databases created with DATE as TIMESTAMP(0) support disabled cannot have this support enabled, even by setting the DB2_COMPATIBILITY_VECTOR registry variable.
DATE as TIMESTAMP(0) support is enabled by setting bit position number 7 (0x40) of the DB2_COMPATIBILITY_VECTOR registry variable before creating a database. A new setting for the registry variable does not take effect until after the instance has been stopped and then restarted.
The following support is enabled for a DB2® database that has the date_compat database configuration parameter set to ON.
When the DATE data type is explicitly encountered in SQL statements, it is implicitly mapped to TIMESTAMP(0). An exception is the specification of SQL DATE in the xml-index-specification clause of a CREATE INDEX statement. As a result of this implicit mapping, messages refer to the TIMESTAMP data type instead of DATE, and any operations that describe data types for columns or routines return TIMESTAMP instead of DATE.
The CURRENT_DATE (and CURRENT DATE) special register returns a TIMESTAMP(0) value that is the same as CURRENT_TIMESTAMP(0).
Adding a numeric value to a TIMESTAMP value or subtracting a numeric value from a TIMESTAMP value assumes that the numeric value represents a number of days. The numeric value can have any numeric data type, and any fractional value is considered to be a fractional portion of a day. For example, TIMESTAMP '2008-03-28 12:00:00' + 1.3 adds 1 day, 7 hours, and 12 minutes to the TIMESTAMP value, resulting in '2008-03-29 19:12:00'. If you are using expressions for partial days, such as 1/24 (1 hour) or 1/24/60 (1 minute), ensure that the number_compat database configuration parameter is set to ON so that the division is performed using DECFLOAT arithmetic.
For databases that have DATE as TIMESTAMP(0) support enabled, if you use the import or load utility to input data into a DATE column (which is based on TIMESTAMP(0)), you must use the TIMESTAMPFORMAT modifier instead of the DATEFORMAT modifier.