DATE and DATETIME data types

Informix® provides two data types to store dates and time information:

Sybase ASE provides these data type to store dates:

String representing date time information

Informix is able to convert quoted strings to DATE / DATETIME data if the string contents matches environment parameters (i.e. DBDATE, GL_DATETIME). As in Informix, Sybase ASE can convert quoted strings representing datetime data in the ANSI format. The CONVERT() SQL function allows you to convert strings to dates.

Date time arithmetic

Solution

Sybase ASE has the same DATE data type as Informix ( year, month, day ). So you can use Sybase ASE DATE data type for Informix DATE columns.

Sybase ASE BIGTIME data type can be used to store Informix DATETIME HOUR TO SECOND and DATETIME HOUR TO FRACTION(5) values. The database interface makes the conversion automatically.

Informix DATETIME values with any precision from YEAR to FRACTION(5) can be stored in Sybase ASE BIGDATETIME columns. The database interface makes the conversion automatically. Missing date or time parts default to 1900-01-01 00:00:00.0. For example, when using a DATETIME HOUR TO MINUTE with the value of "11:45", the ASE TIMESTAMP value will be "1900-01-01 11:45:00.0".

Literal DATETIME and INTERVAL expressions (i.e. DATETIME ( 1999-10-12 ) YEAR TO DAY) are translated by the driver to convert() expressions.

Using integers as a number of days in an expression with dates is not supported by Sybase ASE. Check your code to detect where you are using integers with DATE columns.

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 creat_date >'", adate,"'"

is not portable; use a question mark place holder instead and OPEN the cursor USING adate:

LET stmt = "SELECT ... FROM customer WHERE creat_date > ?"