The DATETIME data type

The SQL DATETIME data type provides the internal (binary) format of a date-time value. This data type stores an instant in time expressed as a calendar date and time of day, a calendar date, or a time of day. You choose how precisely a DATETIME value is stored with a qualifier. The precision can range from a year to a fraction of a second.

Tip: The internal format of the DATETIME data type is often referred to as its binary representation.
The DATETIME data type uses a computer-independent method to encode the date or time qualifiers. It stores the information in the dtime_t structure, as follows:
typedef struct dtime {
   short dt_qual;
   dec_t dt_dec;
} dtime_t;
The dtime structure and dtime_t typedef have two parts:
dt_qual
The qualifier of the datetime value
dt_dec
The digits of the fields of the datetime value

This field is a decimal value.

The DataBlade® API supports the SQL DATETIME data type with the mi_datetime data type. Therefore, the mi_datetime data type holds the binary representation of a date and/or time value.

Values of the mi_datetime data type cannot fit into an MI_DATUM structure. They must be passed by reference within C UDRs.

All data types, including mi_datetime, must be passed by reference within client LIBMI applications.

Because the binary representation of a DATETIME (mi_datetime) value is a proprietary format of HCL Informix®, you cannot use standard system functions to perform operations on mi_datetime values. Instead, the DataBlade API provides the following support for the DATETIME data type.
  • Conversion functions
  • Arithmetic-operation functions