Both the DataBlade API library and the ESQL/C library provide functions that convert from the text (string) representation of a date, time, or interval value to the binary (internal) representation for DATETIME or INTERVAL, respectively.
The DataBlade API provides the following functions for conversion between text and binary representations of date-time or interval data.
The mi_datetime_to_string( ), mi_interval_to_string( ), mi_string_to_datetime( ), and mi_string_to_interval( ) functions convert DATETIME and INTERVAL values to and from the ANSI SQL standards formats for these data types.
The mi_datetime_to_string( ), mi_interval_to_string( ), mi_string_to_datetime( ), and mi_string_to_interval( ) functions are useful in the input and output support functions of an opaque data type that contains mi_datetime and mi_interval values, as long as these values use the ANSI SQL formats. They enable you to convert DATETIME and INTERVAL values between their external format (text) and their internal (binary) format when transferred to and from client applications. For more information, see Conversion of Opaque-Type Data Between Text and Binary Representations.
The ESQL/C function library provides functions for conversion between text and binary representations of date, time, and interval data.
The ESQL/C library provides the following functions that convert internal DATETIME (mi_datetime) values to and from char strings.
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. (For a list of these directives, see the description of DBTIME in the IBM Informix: Guide to SQL Reference.)
The dtextend( ) function extends an mi_datetime value to a different qualifier. You can use it to convert between DATETIME and DATE values.
The ESQL/C library provides the following functions that convert internal INTERVAL (mi_interval) values to and from char text.
The intoasc( ) and incvasc( ) functions convert mi_interval values to and from the ANSI SQL standards for INTERVAL strings. The ANSI SQL standards specify qualifiers and formats for character representations of DATETIME and INTERVAL values. The standards for an INTERVAL value specify the following two classes of intervals:
YYYY-MM
A subset of this format is also valid: for example, just a month interval.
DD HH:MM:SS.F
Any subset of contiguous fields is also valid: for example, MINUTE TO FRACTION.
The intofmtasc( ) and incvfmtasc( ) functions convert mi_interval values to and from an interval string using a time-formatting mask. This time-formatting mask contains the same formatting directives that the DBTIME environment variable supports. (For a list of these directives, see the description of DBTIME in the IBM Informix: Guide to SQL Reference.)
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]