The mi_interval_to_string() function
The mi_interval_to_string() function creates an ANSI SQL standards text (string) representation of an interval value from its binary (internal) INTERVAL representation.
Syntax
mi_string *mi_interval_to_string(intvl_data)
mi_interval *intvl_data;
- intvl_data
- A pointer to the internal INTERVAL representation of the interval value.
Valid in client LIBMI application? | Valid in user-defined routine? |
---|---|
Yes | Yes |
Usage
The mi_interval_to_string() function
converts the internal INTERVAL value that intvl_data references
into an interval string. The interval string has the following ANSI
SQL standards format:
"YYYY-MM-DD HH:mm:SS.FFFFF"
- YYYY
- The 4-digit year.
- MM
- The 2-digit month.
- DD
- The 2-digit day.
- HH
- The 2-digit hour.
- mm
- The 2-digit minute.
- SS
- The 2-digit second.
- FFFFF
- The fraction of a second, in which the date, time, or date and time qualifier specifies the number of digits, with a maximum precision of 5 digits.
If the internal INTERVAL value contains only
a subset of this range, mi_interval_to_string() creates
an interval string with the appropriate portion of the preceding format.
For example, suppose intvl_data references the internal format
of the interval 6 days, 5 hours, and 45 minutes. The mi_interval_to_string() function
returns an mi_string value with the following interval string:
"06 05:45"
For GLS, the mi_interval_to_string() function does not format the interval string in the date and time formats of the current processing locale.
For more information about how to convert internal INTERVAL format to interval strings, see the HCL OneDB™ DataBlade® API Programmer's Guide.
Return values
- An mi_string pointer
- A pointer to the interval string equivalent to intvl_data.
- NULL
- The function was not successful.