Informix® supports the
DATE data type to store year, month and day information:
- DATE = for year, month and day storage.
Genero db has an equivalent type with the same name.
String representing date time information: Informix is able to convert quoted strings
to DATE data, if the string formatting matches the formatting set
by environment parameters (DBDATE). Genero db can also convert quoted
strings to DATE; by default, date/time formats follow the ISO standard
(2005-01-30).
Date arithmetic:
- Informix supports date
arithmetic on DATE values. The result of an arithmetic expression
involving dates is a number of days when DATEs are used.
- In Genero db, the result of an arithmetic expression involving
DATE values is a number of days. You can subtract or add a integer
to a DATE column.
- Informix automatically
converts an integer to a date when the integer is used to set a value
of a date column. Genero db does not do this conversion; review your
code and change it to use a DATE type variable.
Solution
The Genero db DATE type is used
for Informix DATE data.
Arithmetic expressions involving dates (for example, to add or remove
a number of days from a date) will produce the same results with Genero
db as Informix.
Note:
- Using integers (the number of days since 1899/12/31) as dates
is supported by Genero db in a SELECT INTO statement but not in a
WHERE clause. Check your code to detect the use of integers with DATE
columns. With Informix and
Genero db, a date of 1900/1/1 when selected into an INTEGER will be
converted to 1.
- It is strongly recommended that you use BDL variables in dynamic
SQL statements instead of quoted strings representing DATEs.
For example:
LET stmt = "SELECT ... FROM customer
WHERE create_date >'", adate,"'" is not portable. Use
a question mark place holder instead and OPEN the cursor by
USING a date:
LET stmt = "SELECT ... FROM customer
WHERE create_date > ?"
- Before Genero db 3.80, DATE arithmetic expressions using
SQL parameters (USING variables) are not fully supported. For example: "SELECT
... WHERE datecol < ? + 1" generates an error at PREPARE
time.