informix
Informix DataBlade API Programmer's Manual
DataBlade API Function Descriptions

mi_string_to_datetime()

The mi_string_to_datetime() function converts a text (string) representation of a date and/or time value or date and/or time string to its internal (binary) DATETIME representation.

Syntax

Usage

The mi_string_to_datetime() function converts the date and/or time string that dt_string references to its internal DATETIME value. An internal DATETIME value is the format that the database server uses to store a value in a DATETIME column of the database.

The date and/or time string that dt_string references has the following fixed ANSI SQL format:

When you call mi_string_to_datetime() in a C UDR, this date and/or time string can contain only a subset of this range. In this case, the type_range argument must specify the range of qualifiers that the date and/or time string contains. This qualifier range begins with the keyword datetime and is followed by the range of qualifiers for the value in the dt_string. For example, the following call to mi_string_to_datetime() converts the date 01/31/98 and a time of 10:30 A.M. to its internal DATETIME format:

If the type_range argument is a NULL-valued pointer, the mi_string_to_datetime() function assumes a default qualifier range of:

When you call mi_string_to_datetime() in a client LIBMI application, this date and/or time string must contain the full range of qualifiers. The type_range argument must also specify the full range. For example, the following call to mi_string_to_datetime() converts the date 05/31/99 and a time of 8:52 a.m. to its internal DATETIME format:

Important: The mi_string_to_datetime() function replaces the mi_datetime_to_binary() function for string-to-internal-DATETIME conversion in DataBlade API modules.

The mi_string_to_datetime() function does not accept the date and/or time string in the date and time formats of the current processing locale.

Return Values

mi_datetime * is a pointer to the internal DATETIME representation that mi_string_to_datetime() has created.
NULL indicates that the function was not successful.

Related Topics

See the descriptions of the following functions: mi_datetime_to_string(), mi_string_to_date(), mi_string_to_decimal(), mi_string_to_interval(), and mi_string_to_money().

For more information on how to convert date and/or time strings to internal DATETIME format, see Converting Date or Time Between Text and Binary.


Informix DataBlade API Programmer's Manual, Version 9.2
Copyright © 1999, Informix Software, Inc. All rights reserved