Datetime types

Open Client supports six datetime types: CS_DATE, CS_TIME, CS_DATETIME, CS_DATETIME4, CS_BIGDATETIME, and CS_BIGTIME. These datatypes are intended to hold 8-byte and 4-byte datetime values.

The CS_BIGDATETIME and CS_BIGTIME datatypes provide microsecond-level precision for time data. These datatypes are intended to hold 8-byte binary values.These datatypes function similarly to the respective CS_DATETIME and CS_TIME datatypes: The CS_BIGDATETIME datatype can be used anywhere that the CS_DATETIME datatype can be used, and the CS_BIGTIME datatype can be used anywhere that the CS_TIME datatype can be used. All Open Client and Open Server routines that can be applied to the CS_DATETIME and CS_TIME datatypes can also be applied to the CS_BIGDATETIME and CS_BIGTIME datatypes.

An application can call the CS-Library routine cs_convert to initialize a datetime type from a character string. cs_convert recognizes all of the date and time formats valid for Transact-SQL datetime character strings. See the “Datatypes” topic in the Adaptive Server Enterprise Reference Manual.

cs_convert can also convert a CS_DATETIME or CS_DATETIME4 value into a character string.

Other routines that are useful when working with datetime values include:

cs_convert, cs_cmp, cs_dt_crack, and cs_dt_info use locale information that is specified indirectly, using the CS_CONTEXT, or directly, using a CS_LOCALE structure. (See “CS_LOCALE”.) An application can change the locale information for a CS_CONTEXT by calling cs_config to set the CS_LOC_PROP property for the context.