The mi_datetime_to_string() function
The mi_datetime_to_string() function creates an ANSI SQL standard text (string) representation of a date, time, or date and time value from the binary (internal) DATETIME representation.
Syntax
mi_string *mi_datetime_to_string(dt_data)
mi_datetime *dt_data;
- dt_data
- A pointer to the internal DATETIME representation of the date, time, or date and time value.
Valid in client LIBMI application? | Valid in user-defined routine? |
---|---|
Yes | Yes |
Usage
The mi_datetime_to_string() function
converts the internal DATETIME value that dt_data references
into a date, time, or date and time string. This string has the following
ANSI SQL standard 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 DATETIME value contains only a subset
of this range, mi_datetime_to_string() creates
a date, time, or date and time string with the appropriate portion
of the preceding format. For example, suppose dt_data references
the internal format of the date 01/31/07 and a time of 10:30
A.M. The mi_datetime_to_string() function returns
an mi_string value with the following date and time string:
"2007-01-31 10:30"
Important: The mi_datetime_to_string() function
replaces the mi_binary_to_datetime() function for
conversion of a DATETIME value to a date, time, or date and time string
in DataBlade® API modules.
For GLS, the mi_datetime_to_string() function does not format the date, time, or date and time string in the date and time formats of the current processing locale.
For more information about how to convert internal DATETIME values to date, time, or date and time strings, see the HCL OneDB™ DataBlade API Programmer's Guide.
Return values
- An mi_string pointer
- A pointer to the date, time, or date and time string equivalent of dt_data.
- NULL
- The function was not successful.