Data conversion for DATETIME values

The Informix® ESQL/C library provides functions that convert internal DATETIME (mi_datetime) values to and from char strings.

Table 1. Informix ESQL/C functions for data conversion for DATETIME values
Function name Description
dtcvasc() Converts an ANSI-compliant character string to an mi_datetime value
dtcvfmtasc() Converts a character string to an mi_datetime value
dtextend() Changes the qualifier of an mi_datetime value
dttoasc() Converts an mi_datetime value to an ANSI-compliant character string
dttofmtasc() Converts an mi_datetime value to a character string
The dttoasc() and dtcvasc() functions convert mi_datetime values to and from the ANSI SQL standard values for DATETIME strings. The ANSI SQL standards specify qualifiers and formats for character representations of DATETIME and INTERVAL values. The standard qualifier for a DATETIME value is YEAR TO SECOND, and the standard format is as follows:
YYYY-MM-DD HH:MM:SS

The dttofmtasc() and dtcvfmtasc() functions convert mi_datetime values to and from a date-time string using a time-formatting mask. This time-formatting mask contains the same formatting directives that the DBTIME environment variable supports.

The dtextend() function extends an mi_datetime value to a different qualifier. You can use it to convert between DATETIME and DATE values.